From 5a1bf286e86c277c02589e1b3400ae903a38f3863d488f1d8444a58cf176106f Mon Sep 17 00:00:00 2001 From: Benjamin Greiner Date: Sun, 4 Jul 2021 14:22:22 +0000 Subject: [PATCH] Accepting request 903959 from home:bnavigator:branches:devel:languages:python:numeric - Replace astropy-pr11260-wcsfailures.patch with astropy-pr11260+pr11549-wcs76.patch * fixes test failures because of the recent Tumbleweed update to wcslib 7.6 * include binary test file tab-time-last-axis.fits from gh#astropy/astropy#11549, which does not fit into the patchfile OBS-URL: https://build.opensuse.org/request/show/903959 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-astropy?expand=0&rev=55 --- .gitattributes | 2 + ...tch => astropy-pr11260+pr11549-wcs76.patch | 14955 +++++++++++----- python-astropy.changes | 10 + python-astropy.spec | 10 +- tab-time-last-axis.fits | 3 + 5 files changed, 10987 insertions(+), 3993 deletions(-) rename astropy-pr11260-wcsfailures.patch => astropy-pr11260+pr11549-wcs76.patch (73%) create mode 100644 tab-time-last-axis.fits diff --git a/.gitattributes b/.gitattributes index 9b03811..4d13305 100644 --- a/.gitattributes +++ b/.gitattributes @@ -21,3 +21,5 @@ *.xz filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text +## Specific LFS patterns +tab-time-last-axis.fits filter=lfs diff=lfs merge=lfs -text diff --git a/astropy-pr11260-wcsfailures.patch b/astropy-pr11260+pr11549-wcs76.patch similarity index 73% rename from astropy-pr11260-wcsfailures.patch rename to astropy-pr11260+pr11549-wcs76.patch index 4bf3d21..ba82df9 100644 --- a/astropy-pr11260-wcsfailures.patch +++ b/astropy-pr11260+pr11549-wcs76.patch @@ -118,10 +118,10 @@ and enhancements, as per the change log appended below. cextern/wcslib/wcsconfig_utils.h.in | 4 +- 67 files changed, 5703 insertions(+), 5580 deletions(-) -Index: astropy-4.2/astropy/wcs/setup_package.py +Index: astropy-4.2.1/astropy/wcs/setup_package.py =================================================================== ---- astropy-4.2.orig/astropy/wcs/setup_package.py -+++ astropy-4.2/astropy/wcs/setup_package.py +--- astropy-4.2.1.orig/astropy/wcs/setup_package.py ++++ astropy-4.2.1/astropy/wcs/setup_package.py @@ -16,7 +16,7 @@ import numpy from extension_helpers import import_file, write_if_different, get_compiler, pkg_config @@ -131,14 +131,25 @@ Index: astropy-4.2/astropy/wcs/setup_package.py def b(s): -Index: astropy-4.2/cextern/wcslib/C/GNUmakefile +@@ -227,6 +227,10 @@ def get_wcslib_cfg(cfg, wcslib_files, in + if sys.platform.startswith('linux'): + cfg['define_macros'].append(('HAVE_SINCOS', None)) + ++ # For 4.7+ enable C99 syntax in older compilers (need 'gnu99' std for gcc) ++ if get_compiler() == 'unix': ++ cfg['extra_compile_args'].extend(['-std=gnu99']) ++ + # Squelch a few compilation warnings in WCSLIB + if get_compiler() in ('unix', 'mingw32'): + if not debug: +Index: astropy-4.2.1/cextern/wcslib/C/GNUmakefile =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/GNUmakefile -+++ astropy-4.2/cextern/wcslib/C/GNUmakefile +--- astropy-4.2.1.orig/cextern/wcslib/C/GNUmakefile ++++ astropy-4.2.1/cextern/wcslib/C/GNUmakefile @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# GNU makefile for building WCSLIB 7.3 and its test suite. -+# GNU makefile for building WCSLIB 7.4 and its test suite. ++# GNU makefile for building WCSLIB 7.6 and its test suite. # # Summary of the main targets # --------------------------- @@ -147,20 +158,203 @@ Index: astropy-4.2/cextern/wcslib/C/GNUmakefile # Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. # http://www.atnf.csiro.au/people/Mark.Calabretta -# $Id: GNUmakefile,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+# $Id: GNUmakefile,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++# $Id: GNUmakefile,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ #----------------------------------------------------------------------------- # Get configure settings. SUBDIR := C -Index: astropy-4.2/cextern/wcslib/C/cel.c +@@ -78,9 +78,12 @@ TEST_C := twcstab twcshdr tdis3 twcslint + # Test programs that require PGPLOT but not PGSBOX. + TEST_P := tspc tprj2 tcel1 tcel2 ttab2 ttab3 twcsmix + +-# Test programs that require PGPLOT and PGSBOX. ++# Test programs that require PGSBOX (and therefore PGPLOT). + TEST_B := tpih2 + ++# Test program for POSIX threads (code development only). ++TEST_T := tpthreads ++ + # Test programs that are compiled but not automatically exercised. + TEST_X := tsphdpa twcshdr + +@@ -88,24 +91,39 @@ TEST_X := tsphdpa twcshdr + TESTS := $(TEST_N) + + # Do we have CFITSIO? +-ifeq "$(CFITSIOINC)$(CFITSIOLIB)" "" +- # No, amend TEST_X. +- TEST_X := $(filter-out $(TEST_C),$(TEST_X)) +-else ++DO_CFITSIO := 1 ++ifeq "$(CFITSIOINC)" "" ++ DO_CFITSIO := 0 ++else ifeq "$(CFITSIOLIB)" "" ++ DO_CFITSIO := 0 ++endif ++ ++ifeq "$(DO_CFITSIO)" "1" + # Yes, add test programs that use it. + TESTS += $(TEST_C) + CFITSIO_CFLAGS := $(filter-out -Wpadded,$(CFLAGS)) ++else ++ # No, amend TEST_X. ++ TEST_X := $(filter-out $(TEST_C),$(TEST_X)) + endif + + # Do we have PGPLOT? ++DO_PGPLOT := 0 + ifneq "$(CHECK)" "nopgplot" +-ifeq "$(PGPLOTINC)$(PGPLOTLIB)" "" +- # No, amend TEST_X. +- TEST_X := $(filter-out $(TEST_P) $(TEST_B),$(TEST_X)) +-else +- # Yes, add test programs that use it. +- TESTS += $(TEST_P) $(TEST_B) +-endif ++ DO_PGPLOT := 1 ++ ifeq "$(PGPLOTINC)" "" ++ DO_PGPLOT := 0 ++ else ifeq "$(PGPLOTLIB)" "" ++ DO_PGPLOT := 0 ++ endif ++ ++ ifeq "$(DO_PGPLOT)" "1" ++ # Yes, add test programs that use it. ++ TESTS += $(TEST_P) $(TEST_B) ++ else ++ # No, amend TEST_X. ++ TEST_X := $(filter-out $(TEST_P) $(TEST_B),$(TEST_X)) ++ endif + endif + + # Remove tests that aren't automatically exercised. +@@ -248,7 +266,7 @@ run_% : % + #-------------------------------- + + .PHONY : build check clean cleaner cleanest distclean install lib realclean \ +- run_% test tests ++ run_% test tests uninstall + + build : lib + +@@ -338,13 +356,18 @@ install : build + - $(RM) $(INCLINK) + $(LN_S) $(notdir $(INCDIR)) $(INCLINK) + ++uninstall : ++ - cd $(LIBDIR) && $(RM) $(WCSLIB) $(SHRLN) $(SONAME) $(SHRLIB) ++ - $(RM) $(INCDIR) ++ - $(RM) $(INCLINK) ++ + clean : + - $(RM) *.o $(LIBLOCK) *.i a.out t*.out core *.dSYM + - $(RM) -r $(EXTRA_CLEAN) + + cleaner : clean + - $(RM) .gdb_history +- - $(RM) $(TEST_N) $(TEST_n) $(TEST_X) ++ - $(RM) $(TEST_N) $(TEST_n) $(TEST_T) $(TEST_X) + - $(RM) $(TEST_P) tdis3 tpih2 twcshdr twcslint twcstab + - $(RM) tofits + - $(RM) bth.fits fitshdr.fits pih.fits wcslint.fits wcstab.fits +@@ -361,38 +384,20 @@ check test : tests $(TESTS:%=run_%) + + tests : $(TESTS) $(TEST_X) + ++# TEST_N and TEST_n programs (no special libraries required). + $(TEST_N) $(TEST_n) : % : test/%.c $(WCSLIB) + -@ echo '' + $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS) $(WCSLIB) $(LIBS) + -@ $(RM) $@.o + +-$(TEST_P) : % : test/%.c $(WCSLIB) +- -@ echo '' +- $(CC) $(CPPFLAGS) $(PGPLOTINC) $(CFLAGS) -c -o $@.o $< +- $(LD) -o $@ $@.o $(LDFLAGS) $(PGPLOTLIB) $(WCSLIB) $(FLIBS) $(LIBS) +- -@ $(RM) $@.o +- +-tpih2 : test/tpih2.c $(PGSBOXLIB) $(WCSLIB) +- -@ echo '' +- $(CC) $(CPPFLAGS) -I../pgsbox $(PGPLOTINC) $(CFLAGS) -c -o $@.o $< +- $(LD) -o $@ $@.o $(LDFLAGS) $(PGSBOXLIB) $(PGPLOTLIB) $(WCSLIB) \ +- $(FLIBS) $(LIBS) +- -@ $(RM) $@.o +- +-tfitshdr_cfitsio tpih1_cfitsio tbth1_cfitsio : %_cfitsio : test/%.c $(WCSLIB) ++# TEST_N programs (optionally using CFITSIO). ++tpih1_cfitsio tbth1_cfitsio tfitshdr_cfitsio : %_cfitsio : test/%.c $(WCSLIB) + -@ echo '' + $(CC) -DDO_CFITSIO $(CPPFLAGS) $(CFITSIOINC) $(CFITSIO_CFLAGS) \ + -o $@ $< $(LDFLAGS) $(CFITSIOLIB) $(WCSLIB) $(LIBS) + -@ $(RM) $@.o + +-tpih2_cfitsio : test/tpih2.c $(PGSBOXLIB) $(WCSLIB) +- -@ echo '' +- $(CC) -DDO_CFITSIO $(CPPFLAGS) -I../pgsbox $(PGPLOTINC) \ +- $(CFITSIOINC) $(CFITSIO_CFLAGS) -c -o $@.o $< +- $(LD) -o $@ $@.o $(LDFLAGS) $(PGSBOXLIB) $(PGPLOTLIB) \ +- $(CFITSIOLIB) $(WCSLIB) $(FLIBS) $(LIBS) +- -@ $(RM) $@.o +- ++# TEST_C programs (using CFITSIO). + twcstab : test/twcstab.c $(WCSLIB) $(GETWCSTAB) + -@ echo '' + $(CC) $(CPPFLAGS) $(CFITSIOINC) $(CFITSIO_CFLAGS) -o $@ $< \ +@@ -415,6 +420,36 @@ twcslint : test/twcslint + cp $< . + -@ chmod a+x $@ + ++# TEST_P programs (using PGPLOT). ++$(TEST_P) : % : test/%.c $(WCSLIB) ++ -@ echo '' ++ $(CC) $(CPPFLAGS) $(PGPLOTINC) $(CFLAGS) -c -o $@.o $< ++ $(LD) -o $@ $@.o $(LDFLAGS) $(PGPLOTLIB) $(WCSLIB) $(FLIBS) $(LIBS) ++ -@ $(RM) $@.o ++ ++# TEST_B programs (PGSBOX and PGPLOT). ++tpih2 : test/tpih2.c $(PGSBOXLIB) $(WCSLIB) ++ -@ echo '' ++ $(CC) $(CPPFLAGS) -I../pgsbox $(PGPLOTINC) $(CFLAGS) -c -o $@.o $< ++ $(LD) -o $@ $@.o $(LDFLAGS) $(PGSBOXLIB) $(PGPLOTLIB) $(WCSLIB) \ ++ $(FLIBS) $(LIBS) ++ -@ $(RM) $@.o ++ ++tpih2_cfitsio : test/tpih2.c $(PGSBOXLIB) $(WCSLIB) ++ -@ echo '' ++ $(CC) -DDO_CFITSIO $(CPPFLAGS) -I../pgsbox $(PGPLOTINC) \ ++ $(CFITSIOINC) $(CFITSIO_CFLAGS) -c -o $@.o $< ++ $(LD) -o $@ $@.o $(LDFLAGS) $(PGSBOXLIB) $(PGPLOTLIB) \ ++ $(CFITSIOLIB) $(WCSLIB) $(FLIBS) $(LIBS) ++ -@ $(RM) $@.o ++ ++# TEST_T programs (using POSIX threads). ++tpthreads : test/tpthreads.c $(WCSLIB) ++ -@ echo '' ++ $(CC) $(CPPFLAGS) $(CFLAGS) -pthread -c -o $@.o $< ++ $(LD) -o $@ $@.o $(LDFLAGS) -pthread $(WCSLIB) -lpthread $(LIBS) ++ -@ $(RM) $@.o ++ + getwcstab.o : getwcstab.c getwcstab.h + -@ echo '' + $(CC) $(CPPFLAGS) $(CFITSIO_CFLAGS) $(CFITSIOINC) -c $< +@@ -436,6 +471,8 @@ GNUmakefile : ../makedefs ; + show :: + -@ echo ' FLEXMODS := $(FLEXMODS)' + -@ echo ' MODULES := $(MODULES)' ++ -@ echo ' DO_CFITSIO := $(DO_CFITSIO)' ++ -@ echo ' DO_PGPLOT := $(DO_PGPLOT)' + -@ echo ' TESTS := $(TESTS)' + -@ echo ' TEST_X := $(TEST_X)' + +Index: astropy-4.2.1/cextern/wcslib/C/cel.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/cel.c -+++ astropy-4.2/cextern/wcslib/C/cel.c +--- astropy-4.2.1.orig/cextern/wcslib/C/cel.c ++++ astropy-4.2.1/cextern/wcslib/C/cel.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -174,7 +368,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: cel.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: cel.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: cel.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -224,16 +418,45 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c int celfree(struct celprm *cel) -@@ -99,7 +96,7 @@ int celfree(struct celprm *cel) +@@ -99,7 +96,36 @@ int celfree(struct celprm *cel) return cel_prjerr[prjfree(&(cel->prj))]; } -/*--------------------------------------------------------------------------*/ ++//---------------------------------------------------------------------------- ++ ++int celsize(const struct celprm *cel, int sizes[2]) ++ ++{ ++ if (cel == 0x0) { ++ sizes[0] = sizes[1] = 0; ++ return CELERR_SUCCESS; ++ } ++ ++ // Base size, in bytes. ++ sizes[0] = sizeof(struct celprm); ++ ++ // Total size of allocated memory, in bytes. ++ sizes[1] = 0; ++ ++ int exsizes[2]; ++ ++ // celprm::prj. ++ prjsize(&(cel->prj), exsizes); ++ sizes[1] += exsizes[1]; ++ ++ // celprm::err. ++ wcserr_size(cel->err, exsizes); ++ sizes[1] += exsizes[0] + exsizes[1]; ++ ++ return CELERR_SUCCESS; ++} ++ +//---------------------------------------------------------------------------- int celprt(const struct celprm *cel) -@@ -156,7 +153,7 @@ int celprt(const struct celprm *cel) +@@ -156,7 +182,7 @@ int celprt(const struct celprm *cel) return 0; } @@ -242,7 +465,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c int celperr(const struct celprm *cel, const char *prefix) -@@ -171,7 +168,7 @@ int celperr(const struct celprm *cel, co +@@ -171,7 +197,7 @@ int celperr(const struct celprm *cel, co } @@ -251,7 +474,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c int celset(struct celprm *cel) -@@ -189,13 +186,13 @@ int celset(struct celprm *cel) +@@ -189,13 +215,13 @@ int celset(struct celprm *cel) if (cel == 0x0) return CELERR_NULL_POINTER; err = &(cel->err); @@ -267,7 +490,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c celprj->phi0 = UNDEFINED; celprj->theta0 = UNDEFINED; } -@@ -204,7 +201,7 @@ int celset(struct celprm *cel) +@@ -204,7 +230,7 @@ int celset(struct celprm *cel) return wcserr_set(CEL_ERRMSG(cel_prjerr[status])); } @@ -276,7 +499,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c if (undefined(cel->phi0)) { cel->phi0 = celprj->phi0; } -@@ -231,7 +228,7 @@ int celset(struct celprm *cel) +@@ -231,7 +257,7 @@ int celset(struct celprm *cel) phip = cel->ref[2]; latp = cel->ref[3]; @@ -285,7 +508,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c if (undefined(phip) || phip == 999.0) { phip = (lat0 < cel->theta0) ? 180.0 : 0.0; phip += cel->phi0; -@@ -246,15 +243,15 @@ int celset(struct celprm *cel) +@@ -246,15 +272,15 @@ int celset(struct celprm *cel) } @@ -304,7 +527,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c sincosd(lat0, &slat0, &clat0); sincosd(cel->theta0, &sthe0, &cthe0); -@@ -278,7 +275,7 @@ int celset(struct celprm *cel) +@@ -278,7 +304,7 @@ int celset(struct celprm *cel) "lat0 == 0 is required for |phip - phi0| = 90 and theta0 == 0"); } @@ -313,7 +536,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c cel->latpreq = 2; if (latp > 90.0) { latp = 90.0; -@@ -286,7 +283,7 @@ int celset(struct celprm *cel) +@@ -286,7 +312,7 @@ int celset(struct celprm *cel) latp = -90.0; } @@ -322,7 +545,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c u = v = 0.0; } else { -@@ -327,7 +324,7 @@ int celset(struct celprm *cel) +@@ -327,7 +353,7 @@ int celset(struct celprm *cel) if (fabs(latp1) < 90.0+tol && fabs(latp2) < 90.0+tol) { @@ -331,7 +554,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c cel->latpreq = 1; } -@@ -345,7 +342,7 @@ int celset(struct celprm *cel) +@@ -345,7 +371,7 @@ int celset(struct celprm *cel) } } @@ -340,7 +563,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c if (fabs(latp) < 90.0+tol) { if (latp > 90.0) { latp = 90.0; -@@ -358,15 +355,15 @@ int celset(struct celprm *cel) +@@ -358,15 +384,15 @@ int celset(struct celprm *cel) z = cosd(latp)*clat0; if (fabs(z) < tol) { if (fabs(clat0) < tol) { @@ -359,7 +582,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c lngp = lng0 - phip + cel->phi0; } -@@ -374,15 +371,15 @@ int celset(struct celprm *cel) +@@ -374,15 +400,15 @@ int celset(struct celprm *cel) x = (sthe0 - sind(latp)*slat0)/z; y = sphip*cthe0/clat0; if (x == 0.0 && y == 0.0) { @@ -378,7 +601,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c if (lng0 >= 0.0) { if (lngp < 0.0) { lngp += 360.0; -@@ -398,10 +395,10 @@ int celset(struct celprm *cel) +@@ -398,10 +424,10 @@ int celset(struct celprm *cel) } } @@ -391,7 +614,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c cel->euler[0] = lngp; cel->euler[1] = 90.0 - latp; cel->euler[2] = phip; -@@ -409,7 +406,7 @@ int celset(struct celprm *cel) +@@ -409,7 +435,7 @@ int celset(struct celprm *cel) cel->isolat = (cel->euler[4] == 0.0); cel->flag = CELSET; @@ -400,7 +623,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c if (fabs(latp) > 90.0+tol) { return wcserr_set(WCSERR_SET(CELERR_ILL_COORD_TRANS), "Ill-conditioned coordinate transformation parameters\nNo valid " -@@ -419,7 +416,7 @@ int celset(struct celprm *cel) +@@ -419,7 +445,7 @@ int celset(struct celprm *cel) return 0; } @@ -409,7 +632,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c int celx2s( struct celprm *cel, -@@ -442,7 +439,7 @@ int celx2s( +@@ -442,7 +468,7 @@ int celx2s( struct prjprm *celprj; struct wcserr **err; @@ -418,7 +641,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c if (cel == 0x0) return CELERR_NULL_POINTER; err = &(cel->err); -@@ -450,7 +447,7 @@ int celx2s( +@@ -450,7 +476,7 @@ int celx2s( if ((status = celset(cel))) return status; } @@ -427,7 +650,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c celprj = &(cel->prj); if ((istat = celprj->prjx2s(celprj, nx, ny, sxy, 1, x, y, phi, theta, stat))) { -@@ -464,13 +461,13 @@ int celx2s( +@@ -464,13 +490,13 @@ int celx2s( nphi = (ny > 0) ? (nx*ny) : nx; @@ -443,7 +666,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c int cels2x( struct celprm *cel, -@@ -493,7 +490,7 @@ int cels2x( +@@ -493,7 +519,7 @@ int cels2x( struct prjprm *celprj; struct wcserr **err; @@ -452,7 +675,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c if (cel == 0x0) return CELERR_NULL_POINTER; err = &(cel->err); -@@ -501,11 +498,11 @@ int cels2x( +@@ -501,11 +527,11 @@ int cels2x( if ((status = celset(cel))) return status; } @@ -466,7 +689,7 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c nphi = nlng; ntheta = nlat; } else { -@@ -513,7 +510,7 @@ int cels2x( +@@ -513,7 +539,7 @@ int cels2x( ntheta = 0; } @@ -475,16 +698,16 @@ Index: astropy-4.2/cextern/wcslib/C/cel.c celprj = &(cel->prj); if ((istat = celprj->prjs2x(celprj, nphi, ntheta, 1, sxy, phi, theta, x, y, stat))) { -Index: astropy-4.2/cextern/wcslib/C/cel.h +Index: astropy-4.2.1/cextern/wcslib/C/cel.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/cel.h -+++ astropy-4.2/cextern/wcslib/C/cel.h +--- astropy-4.2.1.orig/cextern/wcslib/C/cel.h ++++ astropy-4.2.1/cextern/wcslib/C/cel.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -498,15 +721,59 @@ Index: astropy-4.2/cextern/wcslib/C/cel.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: cel.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: cel.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: cel.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * -@@ -382,50 +379,50 @@ extern "C" { +@@ -51,7 +48,8 @@ + * + * Routine celini() is provided to initialize the celprm struct with default + * values, celfree() reclaims any memory that may have been allocated to store +-* an error message, and celprt() prints its contents. ++* an error message, celsize() computes its total size including allocated ++* memory, and celprt() prints its contents. + * + * celperr() prints the error message(s), if any, stored in a celprm struct and + * the prjprm struct that it contains. +@@ -102,6 +100,33 @@ + * 1: Null celprm pointer passed. + * + * ++* celsize() - Compute the size of a celprm struct ++* ----------------------------------------------- ++* celsize() computes the full size of a celprm struct, including allocated ++* memory. ++* ++* Given: ++* cel const struct celprm* ++* Celestial transformation parameters. ++* ++* If NULL, the base size of the struct and the allocated ++* size are both set to zero. ++* ++* Returned: ++* sizes int[2] The first element is the base size of the struct as ++* returned by sizeof(struct celprm). The second element ++* is the total allocated size, in bytes. This figure ++* includes memory allocated for the constituent struct, ++* celprm::err. ++* ++* It is not an error for the struct not to have been set ++* up via celset(). ++* ++* Function return value: ++* int Status return value: ++* 0: Success. ++* ++* + * celprt() - Print routine for the celprm struct + * ---------------------------------------------- + * celprt() prints the contents of a celprm struct using wcsprintf(). Mainly +@@ -382,50 +407,50 @@ extern "C" { extern const char *cel_errmsg[]; enum cel_errmsg_enum { @@ -593,7 +860,16 @@ Index: astropy-4.2/cextern/wcslib/C/cel.h #define CELLEN (sizeof(struct celprm)/sizeof(int)) -@@ -450,7 +447,7 @@ int cels2x(struct celprm *cel, int nlng, +@@ -433,6 +458,8 @@ int celini(struct celprm *cel); + + int celfree(struct celprm *cel); + ++int celsize(const struct celprm *cel, int sizes[2]); ++ + int celprt(const struct celprm *cel); + + int celperr(const struct celprm *cel, const char *prefix); +@@ -450,7 +477,7 @@ int cels2x(struct celprm *cel, int nlng, int stat[]); @@ -602,22 +878,22 @@ Index: astropy-4.2/cextern/wcslib/C/cel.h #define celini_errmsg cel_errmsg #define celprt_errmsg cel_errmsg #define celset_errmsg cel_errmsg -@@ -461,4 +458,4 @@ int cels2x(struct celprm *cel, int nlng, +@@ -461,4 +488,4 @@ int cels2x(struct celprm *cel, int nlng, } #endif -#endif /* WCSLIB_CEL */ +#endif // WCSLIB_CEL -Index: astropy-4.2/cextern/wcslib/C/dis.c +Index: astropy-4.2.1/cextern/wcslib/C/dis.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/dis.c -+++ astropy-4.2/cextern/wcslib/C/dis.c +--- astropy-4.2.1.orig/cextern/wcslib/C/dis.c ++++ astropy-4.2.1/cextern/wcslib/C/dis.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -631,7 +907,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: dis.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: dis.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: dis.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -875,16 +1151,99 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (dis->axmap && dis->axmap[0]) free(dis->axmap[0]); if (dis->offset && dis->offset[0]) free(dis->offset[0]); if (dis->scale && dis->scale[0]) free(dis->scale[0]); -@@ -430,7 +427,7 @@ int disfree(struct disprm *dis) +@@ -430,7 +427,90 @@ int disfree(struct disprm *dis) return 0; } -/*--------------------------------------------------------------------------*/ ++//---------------------------------------------------------------------------- ++ ++int dissize(const struct disprm *dis, int sizes[2]) ++ ++{ ++ if (dis == 0x0) { ++ sizes[0] = sizes[1] = 0; ++ return DISERR_NULL_POINTER; ++ } ++ ++ // Base size, in bytes. ++ sizes[0] = sizeof(struct disprm); ++ ++ // Total size of allocated memory, in bytes. ++ sizes[1] = 0; ++ ++ int exsizes[2]; ++ int naxis = dis->naxis; ++ ++ // disprm::dtype[]. ++ sizes[1] += naxis * sizeof(char [72]); ++ ++ // disprm::dp[]. ++ sizes[1] += dis->ndpmax * sizeof(struct dpkey); ++ ++ // disprm::maxdis[]. ++ sizes[1] += naxis * sizeof(double); ++ ++ // dis::err[]. ++ wcserr_size(dis->err, exsizes); ++ sizes[1] += exsizes[0] + exsizes[1]; ++ ++ // The remaining arrays are allocated by disset(). ++ if (dis->flag != DISSET) { ++ return DISERR_SUCCESS; ++ } ++ ++ // dis::docorr[]. ++ sizes[1] += naxis * sizeof(int *); ++ ++ // dis::Nhat[]. ++ sizes[1] += naxis * sizeof(int *); ++ ++ // dis::axmap[][]. ++ sizes[1] += naxis * sizeof(int *); ++ sizes[1] += naxis*naxis * sizeof(int); ++ ++ // dis::offset[][]. ++ sizes[1] += naxis * sizeof(double *); ++ sizes[1] += naxis*naxis * sizeof(double); ++ ++ // dis::scale[][]. ++ sizes[1] += naxis * sizeof(double *); ++ sizes[1] += naxis*naxis * sizeof(double); ++ ++ // dis::iparm[][]. ++ sizes[1] += naxis * sizeof(int *); ++ for (int j = 0; j < naxis; j++) { ++ if (dis->iparm[j]) { ++ sizes[1] += dis->iparm[j][I_NIPARM] * sizeof(int); ++ } ++ } ++ ++ // dis::dparm[][]. ++ sizes[1] += naxis * sizeof(double *); ++ for (int j = 0; j < naxis; j++) { ++ if (dis->dparm[j]) { ++ sizes[1] += dis->dparm[j][I_NDPARM] * sizeof(double); ++ } ++ } ++ ++ // dis::disp2x[]. ++ sizes[1] += naxis * sizeof(int (*)(DISP2X_ARGS)); ++ ++ // dis::disx2p[]. ++ sizes[1] += naxis * sizeof(int (*)(DISX2P_ARGS)); ++ ++ // dis::tmpmem[]. ++ sizes[1] += 5*naxis * sizeof(double); ++ ++ return DISERR_SUCCESS; ++} ++ +//---------------------------------------------------------------------------- int disprt(const struct disprm *dis) -@@ -450,7 +447,7 @@ int disprt(const struct disprm *dis) +@@ -450,7 +530,7 @@ int disprt(const struct disprm *dis) wcsprintf(" flag: %d\n", dis->flag); @@ -893,7 +1252,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c wcsprintf(" naxis: %d\n", naxis); WCSPRINTF_PTR(" dtype: ", dis->dtype, "\n"); -@@ -480,7 +477,7 @@ int disprt(const struct disprm *dis) +@@ -480,7 +560,7 @@ int disprt(const struct disprm *dis) wcsprintf(" totdis: %#- 11.5g\n", dis->totdis); @@ -902,7 +1261,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c WCSPRINTF_PTR(" docorr: ", dis->docorr, "\n"); wcsprintf(" "); for (j = 0; j < naxis; j++) { -@@ -559,13 +556,13 @@ int disprt(const struct disprm *dis) +@@ -559,13 +639,13 @@ int disprt(const struct disprm *dis) wcsprintf(" i_naxis: %d\n", dis->i_naxis); wcsprintf(" ndis: %d\n", dis->ndis); @@ -918,7 +1277,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c WCSPRINTF_PTR(" disp2x: ", dis->disp2x, "\n"); for (j = 0; j < naxis; j++) { wcsprintf(" disp2x[%d]: %s", j, -@@ -601,7 +598,7 @@ int disprt(const struct disprm *dis) +@@ -601,7 +681,7 @@ int disprt(const struct disprm *dis) } WCSPRINTF_PTR(" tmpmem: ", dis->tmpmem, "\n"); @@ -927,7 +1286,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c wcsprintf(" m_flag: %d\n", dis->m_flag); wcsprintf(" m_naxis: %d\n", dis->m_naxis); WCSPRINTF_PTR(" m_dtype: ", dis->m_dtype, ""); -@@ -617,7 +614,7 @@ int disprt(const struct disprm *dis) +@@ -617,7 +697,7 @@ int disprt(const struct disprm *dis) return 0; } @@ -936,7 +1295,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int disperr(const struct disprm *dis, const char *prefix) -@@ -631,7 +628,7 @@ int disperr(const struct disprm *dis, co +@@ -631,7 +711,7 @@ int disperr(const struct disprm *dis, co return 0; } @@ -945,7 +1304,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int dishdo(struct disprm *dis) -@@ -648,13 +645,13 @@ int dishdo(struct disprm *dis) +@@ -648,13 +728,13 @@ int dishdo(struct disprm *dis) for (j = 0; j < dis->naxis; j++) { if (dis->iparm[j][I_DTYPE]) { if (dis->iparm[j][I_DTYPE] == DIS_TPD) { @@ -962,7 +1321,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c status = wcserr_set(WCSERR_SET(DISERR_BAD_PARAM), "Translation of %s to TPD is not possible", dis->dtype[j]); } -@@ -664,7 +661,7 @@ int dishdo(struct disprm *dis) +@@ -664,7 +744,7 @@ int dishdo(struct disprm *dis) return status; } @@ -971,7 +1330,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int disset(struct disprm *dis) -@@ -682,7 +679,7 @@ int disset(struct disprm *dis) +@@ -682,7 +762,7 @@ int disset(struct disprm *dis) naxis = dis->naxis; @@ -980,7 +1339,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (dis->ndp < 0) { return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM), "disprm::ndp is negative (%d)", dis->ndp); -@@ -697,7 +694,7 @@ int disset(struct disprm *dis) +@@ -697,7 +777,7 @@ int disset(struct disprm *dis) } if (dis->ndp) { @@ -989,7 +1348,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (dis->dp[0].field[1] == 'P') { dpq = "DPja"; } else if (dis->dp[0].field[1] == 'Q') { -@@ -714,26 +711,26 @@ int disset(struct disprm *dis) +@@ -714,26 +794,26 @@ int disset(struct disprm *dis) "distortion"); } @@ -1022,7 +1381,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c free(dis->axmap[0]); free(dis->axmap); free(dis->offset[0]); -@@ -760,7 +757,7 @@ int disset(struct disprm *dis) +@@ -760,7 +840,7 @@ int disset(struct disprm *dis) return wcserr_set(DIS_ERRMSG(DISERR_MEMORY)); } @@ -1031,7 +1390,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if ((dis->axmap = calloc(naxis, sizeof(int *))) == 0x0) { disfree(dis); return wcserr_set(DIS_ERRMSG(DISERR_MEMORY)); -@@ -775,7 +772,7 @@ int disset(struct disprm *dis) +@@ -775,7 +855,7 @@ int disset(struct disprm *dis) dis->axmap[j] = dis->axmap[j-1] + naxis; } @@ -1040,7 +1399,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if ((dis->offset = calloc(naxis, sizeof(double *))) == 0x0) { disfree(dis); return wcserr_set(DIS_ERRMSG(DISERR_MEMORY)); -@@ -790,7 +787,7 @@ int disset(struct disprm *dis) +@@ -790,7 +870,7 @@ int disset(struct disprm *dis) dis->offset[j] = dis->offset[j-1] + naxis; } @@ -1049,7 +1408,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if ((dis->scale = calloc(naxis, sizeof(double *))) == 0x0) { disfree(dis); return wcserr_set(DIS_ERRMSG(DISERR_MEMORY)); -@@ -833,7 +830,7 @@ int disset(struct disprm *dis) +@@ -833,7 +913,7 @@ int disset(struct disprm *dis) dis->i_naxis = naxis; } @@ -1058,7 +1417,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c for (j = 0; j < naxis; j++) { dis->docorr[j] = 1; } -@@ -850,7 +847,7 @@ int disset(struct disprm *dis) +@@ -850,7 +930,7 @@ int disset(struct disprm *dis) dis->scale[0][jhat] = 1.0; } @@ -1067,7 +1426,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c dis->i_naxis = naxis; dis->ndis = 0; -@@ -860,10 +857,10 @@ int disset(struct disprm *dis) +@@ -860,10 +940,10 @@ int disset(struct disprm *dis) memset(dis->tmpmem, 0, naxis*sizeof(double)); @@ -1080,7 +1439,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (keyp->field[1] != dpq[1]) { return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM), "disprm::dp appears to contain a mix of DPja and DQia keys"); -@@ -882,7 +879,7 @@ int disset(struct disprm *dis) +@@ -882,7 +962,7 @@ int disset(struct disprm *dis) } fp++; @@ -1089,7 +1448,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c j--; if (strncmp(fp, "DOCORR", 7) == 0) { -@@ -908,7 +905,7 @@ int disset(struct disprm *dis) +@@ -908,7 +988,7 @@ int disset(struct disprm *dis) dis->dtype[j], keyp->field, jhat); } @@ -1098,7 +1457,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c dis->axmap[j][jhat-1] = dpkeyi(keyp) - 1; } else if (strncmp(fp, "OFFSET.", 7) == 0) { -@@ -921,10 +918,10 @@ int disset(struct disprm *dis) +@@ -921,10 +1001,10 @@ int disset(struct disprm *dis) } } @@ -1111,7 +1470,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c keyp = dis->dp; for (idp = 0; idp < dis->ndp; idp++, keyp++) { if (keyp->j == j+1) { -@@ -937,14 +934,14 @@ int disset(struct disprm *dis) +@@ -937,14 +1017,14 @@ int disset(struct disprm *dis) continue; } @@ -1128,7 +1487,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c Nhat = dis->Nhat[j]; for (jhat = 0; jhat < Nhat; jhat++) { if (dis->axmap[j][jhat] == -1) { -@@ -952,7 +949,7 @@ int disset(struct disprm *dis) +@@ -952,7 +1032,7 @@ int disset(struct disprm *dis) } } @@ -1137,7 +1496,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c Nhat = 0; for (jhat = 0; jhat < naxis; jhat++) { if (dis->axmap[j][jhat] != -1) Nhat = jhat+1; -@@ -964,7 +961,7 @@ int disset(struct disprm *dis) +@@ -964,7 +1044,7 @@ int disset(struct disprm *dis) dis->dtype[j], j+1); } @@ -1146,7 +1505,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c for (jhat = 0; jhat < Nhat; jhat++) { for (k = 0; k < jhat; k++) { if (dis->axmap[j][jhat] == dis->axmap[j][k]) { -@@ -977,11 +974,11 @@ int disset(struct disprm *dis) +@@ -977,11 +1057,11 @@ int disset(struct disprm *dis) } @@ -1160,7 +1519,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c continue; } -@@ -990,47 +987,47 @@ int disset(struct disprm *dis) +@@ -990,47 +1070,47 @@ int disset(struct disprm *dis) "Empty axis map for %s distortion on axis %d", dis->dtype[j], j+1); } @@ -1221,7 +1580,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c return status; } -@@ -1048,7 +1045,7 @@ int disset(struct disprm *dis) +@@ -1048,7 +1128,7 @@ int disset(struct disprm *dis) return 0; } @@ -1230,7 +1589,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int disp2x( struct disprm *dis, -@@ -1063,7 +1060,7 @@ int disp2x( +@@ -1063,7 +1143,7 @@ int disp2x( struct wcserr **err; @@ -1239,7 +1598,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (dis == 0x0) return DISERR_NULL_POINTER; err = &(dis->err); -@@ -1074,7 +1071,7 @@ int disp2x( +@@ -1074,7 +1154,7 @@ int disp2x( naxis = dis->naxis; @@ -1248,7 +1607,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c tmpcrd = dis->tmpmem; for (j = 0; j < naxis; j++) { if (dis->disp2x[j]) { -@@ -1093,10 +1090,10 @@ int disp2x( +@@ -1093,10 +1173,10 @@ int disp2x( } if (dis->docorr[j]) { @@ -1261,7 +1620,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c discrd[j] = dtmp; } -@@ -1108,9 +1105,9 @@ int disp2x( +@@ -1108,9 +1188,9 @@ int disp2x( return 0; } @@ -1274,7 +1633,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int disitermax(int itermax) -@@ -1124,7 +1121,7 @@ int disitermax(int itermax) +@@ -1124,7 +1204,7 @@ int disitermax(int itermax) return ITERMAX; } @@ -1283,7 +1642,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int disx2p( struct disprm *dis, -@@ -1142,28 +1139,28 @@ int disx2p( +@@ -1142,28 +1222,28 @@ int disx2p( struct wcserr **err; @@ -1321,7 +1680,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c for (j = 0; j < naxis; j++) { if (dis->disx2p[j]) { offset = dis->offset[j]; -@@ -1182,28 +1179,28 @@ int disx2p( +@@ -1182,28 +1262,28 @@ int disx2p( } if (dis->docorr[j]) { @@ -1355,7 +1714,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c convergence = 1; for (j = 0; j < naxis; j++) { delta[j] = discrd[j] - dcrd0[j]; -@@ -1211,22 +1208,22 @@ int disx2p( +@@ -1211,22 +1291,22 @@ int disx2p( if (fabs(discrd[j]) < 1.0) { dd = delta[j]; } else { @@ -1383,7 +1742,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c delta[j] /= 2.0; if (fabs(delta[j]) < 1.0e-6) { if (delta[j] < 0.0) { -@@ -1244,40 +1241,40 @@ int disx2p( +@@ -1244,40 +1324,40 @@ int disx2p( } if (iter < itermax/2) { @@ -1435,7 +1794,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c rawcrd[j] += (discrd[j] - dcrd0[j]) * (delta[j]/(dcrd1[j] - dcrd0[j])); -@@ -1304,7 +1301,7 @@ int disx2p( +@@ -1304,7 +1384,7 @@ int disx2p( return 0; } @@ -1444,7 +1803,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int diswarp( struct disprm *dis, -@@ -1328,7 +1325,7 @@ int diswarp( +@@ -1328,7 +1408,7 @@ int diswarp( struct wcserr **err; @@ -1453,7 +1812,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (dis == 0x0) return DISERR_NULL_POINTER; err = &(dis->err); -@@ -1344,16 +1341,16 @@ int diswarp( +@@ -1344,16 +1424,16 @@ int diswarp( if (avgtot) *avgtot = 0.0; if (rmstot) *rmstot = 0.0; @@ -1473,7 +1832,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c for (j = 0; j < naxis; j++) { pixspan = pixtrc[j] - (pixblc ? pixblc[j] : 1.0); -@@ -1370,7 +1367,7 @@ int diswarp( +@@ -1370,7 +1450,7 @@ int diswarp( } } @@ -1482,7 +1841,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if ((pix0 = calloc(2*naxis, sizeof(double))) == 0x0) { return wcserr_set(DIS_ERRMSG(DISERR_MEMORY)); } -@@ -1378,13 +1375,13 @@ int diswarp( +@@ -1378,13 +1458,13 @@ int diswarp( pix1 = pix0 + naxis; @@ -1498,7 +1857,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c for (j = 0; j < naxis; j++) { sumdis[j] = 0.0; ssqdis[j] = 0.0; -@@ -1393,15 +1390,15 @@ int diswarp( +@@ -1393,15 +1473,15 @@ int diswarp( ssqtot = 0.0; @@ -1517,7 +1876,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c (*nsamp)++; dssq = 0.0; -@@ -1427,7 +1424,7 @@ int diswarp( +@@ -1427,7 +1507,7 @@ int diswarp( *maxtot = totdis; } @@ -1526,7 +1885,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c for (j = 0; j < naxis; j++) { pix0[j] += pixinc[j]; if (pix0[j] < pixend[j]) { -@@ -1441,7 +1438,7 @@ int diswarp( +@@ -1441,7 +1521,7 @@ int diswarp( } @@ -1535,7 +1894,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c for (j = 0; j < naxis; j++) { ssqdis[j] /= *nsamp; sumdis[j] /= *nsamp; -@@ -1461,7 +1458,7 @@ cleanup: +@@ -1461,7 +1541,7 @@ cleanup: return status; } @@ -1544,7 +1903,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int polyset(int j, struct disprm *dis) -@@ -1476,7 +1473,7 @@ int polyset(int j, struct disprm *dis) +@@ -1476,7 +1556,7 @@ int polyset(int j, struct disprm *dis) struct wcserr **err; @@ -1553,7 +1912,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (dis == 0x0) return DISERR_NULL_POINTER; err = &(dis->err); -@@ -1484,7 +1481,7 @@ int polyset(int j, struct disprm *dis) +@@ -1484,7 +1564,7 @@ int polyset(int j, struct disprm *dis) sprintf(id, "Polynomial on axis %d", j+1); @@ -1562,7 +1921,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c K = 0; M = 0; keyp = dis->dp; -@@ -1520,31 +1517,31 @@ int polyset(int j, struct disprm *dis) +@@ -1520,31 +1600,31 @@ int polyset(int j, struct disprm *dis) nTparm = 1 + nVar; ndparm = K*nKparm + M*nTparm; @@ -1613,7 +1972,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if ((dis->iparm[j] = calloc(niparm, sizeof(int))) == 0x0) { return wcserr_set(DIS_ERRMSG(DISERR_MEMORY)); } -@@ -1553,12 +1550,12 @@ int polyset(int j, struct disprm *dis) +@@ -1553,12 +1633,12 @@ int polyset(int j, struct disprm *dis) return wcserr_set(DIS_ERRMSG(DISERR_MEMORY)); } @@ -1628,7 +1987,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c iparm[I_DTYPE] = DIS_POLYNOMIAL; iparm[I_NIPARM] = niparm; iparm[I_NDPARM] = ndparm; -@@ -1579,7 +1576,7 @@ int polyset(int j, struct disprm *dis) +@@ -1579,7 +1659,7 @@ int polyset(int j, struct disprm *dis) iparm[I_FLAGS] = iparm[I_DPOFF] + nVar; iparm[I_IPOW] = iparm[I_FLAGS] + M*nVar; @@ -1637,7 +1996,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c dptr = dparm + (1 + Nhat); for (k = 0; k < K; k++) { for (jhat = 0; jhat <= Nhat; jhat++) { -@@ -1588,24 +1585,24 @@ int polyset(int j, struct disprm *dis) +@@ -1588,24 +1668,24 @@ int polyset(int j, struct disprm *dis) dptr += nKparm; } @@ -1666,7 +2025,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c fp += 4; sscanf(fp, "%d", &k); if (k < 1 || K < k) { -@@ -1633,7 +1630,7 @@ int polyset(int j, struct disprm *dis) +@@ -1633,7 +1713,7 @@ int polyset(int j, struct disprm *dis) fp += 6; sscanf(fp, "%d", &jhat); if (jhat < 0 || naxis < jhat) { @@ -1675,7 +2034,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c return wcserr_set(WCSERR_SET(DISERR_BAD_PARAM), "Invalid axis number (%d) for %s: %s", jhat, id, keyp->field); } -@@ -1642,7 +1639,7 @@ int polyset(int j, struct disprm *dis) +@@ -1642,7 +1722,7 @@ int polyset(int j, struct disprm *dis) dparm[i] = dpkeyd(keyp); } else if (strncmp(fp, "TERM.", 5) == 0) { @@ -1684,7 +2043,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c fp += 5; sscanf(fp, "%d", &m); if (m < 1 || M < m) { -@@ -1661,7 +1658,7 @@ int polyset(int j, struct disprm *dis) +@@ -1661,7 +1741,7 @@ int polyset(int j, struct disprm *dis) dparm[i] = dpkeyd(keyp); } else if (strncmp(fp, "VAR.", 4) == 0) { @@ -1693,7 +2052,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c fp += 4; sscanf(fp, "%d", &jhat); if (jhat < 1 || naxis < jhat) { -@@ -1674,7 +1671,7 @@ int polyset(int j, struct disprm *dis) +@@ -1674,7 +1754,7 @@ int polyset(int j, struct disprm *dis) dparm[i] = power; } else if (strncmp(fp, "AUX.", 4) == 0) { @@ -1702,7 +2061,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c fp += 4; sscanf(fp, "%d", &k); if (k < 1 || K < k) { -@@ -1704,16 +1701,16 @@ int polyset(int j, struct disprm *dis) +@@ -1704,16 +1784,16 @@ int polyset(int j, struct disprm *dis) } @@ -1728,7 +2087,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c i = iparm[I_MAXPOW] + ivar; iparm[i] = 1; } -@@ -1723,10 +1720,10 @@ int polyset(int j, struct disprm *dis) +@@ -1723,10 +1803,10 @@ int polyset(int j, struct disprm *dis) i = iparm[I_DPOLY] + m*nTparm + 1 + ivar; power = dparm[i]; @@ -1741,7 +2100,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c i = iparm[I_FLAGS] + m*nVar + ivar; if (ipow == 0) { iparm[i] = 3; -@@ -1734,12 +1731,12 @@ int polyset(int j, struct disprm *dis) +@@ -1734,12 +1814,12 @@ int polyset(int j, struct disprm *dis) iparm[i] = 1; } @@ -1756,7 +2115,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c i = iparm[I_MAXPOW] + ivar; if (iparm[i] < abs(ipow)) { iparm[i] = abs(ipow); -@@ -1747,10 +1744,10 @@ int polyset(int j, struct disprm *dis) +@@ -1747,10 +1827,10 @@ int polyset(int j, struct disprm *dis) } } @@ -1769,7 +2128,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c i = iparm[I_DPOFF] + ivar; iparm[i] = lendp + npow; -@@ -1758,7 +1755,7 @@ int polyset(int j, struct disprm *dis) +@@ -1758,7 +1838,7 @@ int polyset(int j, struct disprm *dis) npow += iparm[i]; } @@ -1778,7 +2137,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (npow) { lendp += npow; iparm[I_LENDP] = lendp; -@@ -1767,12 +1764,12 @@ int polyset(int j, struct disprm *dis) +@@ -1767,12 +1847,12 @@ int polyset(int j, struct disprm *dis) } } @@ -1794,7 +2153,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (strcmp(dis->dtype[j], "Polynomial") == 0) { pol2tpd(j, dis); } -@@ -1780,7 +1777,7 @@ int polyset(int j, struct disprm *dis) +@@ -1780,7 +1860,7 @@ int polyset(int j, struct disprm *dis) return 0; } @@ -1803,7 +2162,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int tpdset(int j, struct disprm *dis) -@@ -1799,14 +1796,14 @@ int tpdset(int j, struct disprm *dis) +@@ -1799,14 +1879,14 @@ int tpdset(int j, struct disprm *dis) sprintf(id, "TPD on axis %d", j+1); @@ -1820,7 +2179,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c ncoeff[0] = 0; ncoeff[1] = 0; doaux = 0; -@@ -1823,7 +1820,7 @@ int tpdset(int j, struct disprm *dis) +@@ -1823,7 +1903,7 @@ int tpdset(int j, struct disprm *dis) idis = 0; } else if (strncmp(fp, "REV.", 4) == 0) { @@ -1829,7 +2188,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c idis = 1; } else { -@@ -1835,7 +1832,7 @@ int tpdset(int j, struct disprm *dis) +@@ -1835,7 +1915,7 @@ int tpdset(int j, struct disprm *dis) if (0 <= k && k <= 59) { if (ncoeff[idis] < k+1) ncoeff[idis] = k+1; @@ -1838,7 +2197,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (k == 3 || k == 11 || k == 23 || k == 39 || k == 59) { doradial = 1; } -@@ -1846,7 +1843,7 @@ int tpdset(int j, struct disprm *dis) +@@ -1846,7 +1926,7 @@ int tpdset(int j, struct disprm *dis) } } else if (strncmp(fp, "AUX.", 4) == 0) { @@ -1847,7 +2206,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c doaux = 1; } else if (strcmp(fp, "DOCORR") && -@@ -1864,43 +1861,43 @@ int tpdset(int j, struct disprm *dis) +@@ -1864,43 +1944,43 @@ int tpdset(int j, struct disprm *dis) for (idis = 0; idis < 2; idis++) { if (ncoeff[idis] <= 4) { if (idis) { @@ -1901,7 +2260,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c ncoeff[idis] = 60; distpd[idis] = tpd9; } else { -@@ -1909,20 +1906,20 @@ int tpdset(int j, struct disprm *dis) +@@ -1909,20 +1989,20 @@ int tpdset(int j, struct disprm *dis) } } @@ -1930,7 +2289,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c niparm = I_NTPD; if ((dis->iparm[j] = calloc(niparm, sizeof(int))) == 0x0) { return wcserr_set(DIS_ERRMSG(DISERR_MEMORY)); -@@ -1930,28 +1927,28 @@ int tpdset(int j, struct disprm *dis) +@@ -1930,28 +2010,28 @@ int tpdset(int j, struct disprm *dis) ndparm = (doaux?6:0) + ncoeff[0] + ncoeff[1]; @@ -1965,7 +2324,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (doaux) { dis->dparm[j][1] = 1.0; dis->dparm[j][5] = 1.0; -@@ -1964,7 +1961,7 @@ int tpdset(int j, struct disprm *dis) +@@ -1964,7 +2044,7 @@ int tpdset(int j, struct disprm *dis) fp = strchr(keyp->field, '.') + 1; if (strncmp(fp, "AUX.", 4) == 0) { @@ -1974,7 +2333,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c fp += 4; sscanf(fp, "%d", &k); if (k < 1 || 2 < k) { -@@ -2008,7 +2005,7 @@ int tpdset(int j, struct disprm *dis) +@@ -2008,7 +2088,7 @@ int tpdset(int j, struct disprm *dis) return 0; } @@ -1983,7 +2342,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int pol2tpd(int j, struct disprm *dis) -@@ -2031,7 +2028,7 @@ int pol2tpd(int j, struct disprm *dis) +@@ -2031,7 +2111,7 @@ int pol2tpd(int j, struct disprm *dis) double *dparm, *dpolp, *tpd_dparm; struct wcserr **err; @@ -1992,7 +2351,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (dis == 0x0) return DISERR_NULL_POINTER; err = &(dis->err); -@@ -2039,15 +2036,15 @@ int pol2tpd(int j, struct disprm *dis) +@@ -2039,15 +2119,15 @@ int pol2tpd(int j, struct disprm *dis) dparm = dis->dparm[j]; @@ -2011,7 +2370,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (dparm[0] != 0.0) return -1; if (dparm[1] != 1.0) return -1; if (dparm[2] != 1.0) return -1; -@@ -2056,14 +2053,14 @@ int pol2tpd(int j, struct disprm *dis) +@@ -2056,14 +2136,14 @@ int pol2tpd(int j, struct disprm *dis) if (dparm[5] != 2.0) return -1; } @@ -2028,7 +2387,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (*iflgp == 0) return -1; if (*ipowp < 0) return -1; deg += *ipowp; -@@ -2071,20 +2068,20 @@ int pol2tpd(int j, struct disprm *dis) +@@ -2071,20 +2151,20 @@ int pol2tpd(int j, struct disprm *dis) ipowp++; } @@ -2053,7 +2412,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c deg = *ipowp; if (!(deg%2)) return -1; } -@@ -2096,7 +2093,7 @@ int pol2tpd(int j, struct disprm *dis) +@@ -2096,7 +2176,7 @@ int pol2tpd(int j, struct disprm *dis) } @@ -2062,7 +2421,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c ndparm = 0; if (degree == 1) { ndparm = 4; -@@ -2127,32 +2124,32 @@ int pol2tpd(int j, struct disprm *dis) +@@ -2127,32 +2207,32 @@ int pol2tpd(int j, struct disprm *dis) dis->disp2x[j] = tpd9; } @@ -2102,7 +2461,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if ((tpd_dparm = calloc(ndparm, sizeof(double))) == 0x0) { return wcserr_set(DIS_ERRMSG(DISERR_MEMORY)); } -@@ -2161,7 +2158,7 @@ int pol2tpd(int j, struct disprm *dis) +@@ -2161,7 +2241,7 @@ int pol2tpd(int j, struct disprm *dis) dpolp = dparm + iparm[I_DPOLY]; for (m = 0; m < iparm[I_M]; m++) { if (K && ipowp[Nhat]) { @@ -2111,7 +2470,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c switch (ipowp[Nhat]) { case 1: tpd_dparm[3] = *dpolp; -@@ -2181,7 +2178,7 @@ int pol2tpd(int j, struct disprm *dis) +@@ -2181,7 +2261,7 @@ int pol2tpd(int j, struct disprm *dis) } } else { @@ -2120,7 +2479,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c p[0] = p[1] = 0; for (jhat = 0; jhat < Nhat; jhat++) { p[jhat] = ipowp[jhat]; -@@ -2197,7 +2194,7 @@ int pol2tpd(int j, struct disprm *dis) +@@ -2197,7 +2277,7 @@ int pol2tpd(int j, struct disprm *dis) } @@ -2129,7 +2488,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c free(iparm); free(dparm); dis->iparm[j] = tpd_iparm; -@@ -2206,7 +2203,7 @@ int pol2tpd(int j, struct disprm *dis) +@@ -2206,7 +2286,7 @@ int pol2tpd(int j, struct disprm *dis) return 0; } @@ -2138,7 +2497,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int tpvset(int j, struct disprm *dis) -@@ -2219,14 +2216,15 @@ int tpvset(int j, struct disprm *dis) +@@ -2219,14 +2299,15 @@ int tpvset(int j, struct disprm *dis) struct wcserr **err; @@ -2157,7 +2516,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c dis->docorr[j] = 0; if (dis->Nhat[j] != 2) { -@@ -2234,7 +2232,7 @@ int tpvset(int j, struct disprm *dis) +@@ -2234,7 +2315,7 @@ int tpvset(int j, struct disprm *dis) "Axis map for %s must contain 2 entries, not %d", id, dis->Nhat[j]); } @@ -2166,7 +2525,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c ndparm = 0; doradial = 0; keyp = dis->dp; -@@ -2248,7 +2246,7 @@ int tpvset(int j, struct disprm *dis) +@@ -2248,7 +2329,7 @@ int tpvset(int j, struct disprm *dis) if (0 <= k && k <= 39) { if (ndparm < k+1) ndparm = k+1; @@ -2175,7 +2534,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (k == 3 || k == 11 || k == 23 || k == 39 || k == 59) { doradial = 1; } -@@ -2267,67 +2265,67 @@ int tpvset(int j, struct disprm *dis) +@@ -2267,67 +2348,67 @@ int tpvset(int j, struct disprm *dis) } } @@ -2259,7 +2618,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if ((dis->dparm[j] = calloc(ndparm, sizeof(double))) == 0x0) { return wcserr_set(DIS_ERRMSG(DISERR_MEMORY)); } -@@ -2338,7 +2336,7 @@ int tpvset(int j, struct disprm *dis) +@@ -2338,7 +2419,7 @@ int tpvset(int j, struct disprm *dis) fp = strchr(keyp->field, '.') + 1; @@ -2268,7 +2627,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (strncmp(fp, "TPV.", 4) == 0) { sscanf(fp+4, "%d", &k); dis->dparm[j][k] = dpkeyd(keyp); -@@ -2348,7 +2346,7 @@ int tpvset(int j, struct disprm *dis) +@@ -2348,7 +2429,7 @@ int tpvset(int j, struct disprm *dis) return 0; } @@ -2277,7 +2636,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int sipset(int j, struct disprm *dis) -@@ -2373,15 +2371,15 @@ int sipset(int j, struct disprm *dis) +@@ -2373,15 +2454,15 @@ int sipset(int j, struct disprm *dis) int (*(distpd[2]))(DISP2X_ARGS); @@ -2296,7 +2655,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c dis->docorr[j] = 1; if (dis->Nhat[j] != 2) { -@@ -2389,7 +2387,7 @@ int sipset(int j, struct disprm *dis) +@@ -2389,7 +2470,7 @@ int sipset(int j, struct disprm *dis) "Axis map for %s must contain 2 entries, not %d", id, dis->Nhat[j]); } @@ -2305,7 +2664,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c degree[0] = 1; degree[1] = -1; keyp = dis->dp; -@@ -2404,7 +2402,7 @@ int sipset(int j, struct disprm *dis) +@@ -2404,7 +2485,7 @@ int sipset(int j, struct disprm *dis) idis = 0; } else if (strncmp(fp, "REV.", 4) == 0) { @@ -2314,7 +2673,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c idis = 1; } else { -@@ -2433,7 +2431,7 @@ int sipset(int j, struct disprm *dis) +@@ -2433,7 +2514,7 @@ int sipset(int j, struct disprm *dis) if (degree[1] == 0 ) degree[1] = 1; @@ -2323,7 +2682,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c distpd[0] = 0x0; distpd[1] = 0x0; for (idis = 0; idis < 2; idis++) { -@@ -2468,13 +2466,13 @@ int sipset(int j, struct disprm *dis) +@@ -2468,13 +2549,13 @@ int sipset(int j, struct disprm *dis) } } @@ -2340,7 +2699,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c niparm = I_NTPD; if ((dis->iparm[j] = calloc(niparm, sizeof(int))) == 0x0) { return wcserr_set(DIS_ERRMSG(DISERR_MEMORY)); -@@ -2482,23 +2480,23 @@ int sipset(int j, struct disprm *dis) +@@ -2482,23 +2563,23 @@ int sipset(int j, struct disprm *dis) ndparm = ncoeff[0] + ncoeff[1]; @@ -2369,7 +2728,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if ((dis->dparm[j] = calloc(ndparm, sizeof(double))) == 0x0) { return wcserr_set(DIS_ERRMSG(DISERR_MEMORY)); } -@@ -2519,7 +2517,7 @@ int sipset(int j, struct disprm *dis) +@@ -2519,7 +2600,7 @@ int sipset(int j, struct disprm *dis) sscanf(fp+4, "%d_%d", &p, &q); @@ -2378,7 +2737,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c idis += map[p][q]; dis->dparm[j][idis] = dpkeyd(keyp); -@@ -2530,7 +2528,7 @@ int sipset(int j, struct disprm *dis) +@@ -2530,7 +2611,7 @@ int sipset(int j, struct disprm *dis) return 0; } @@ -2387,7 +2746,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int dssset(int j, struct disprm *dis) -@@ -2544,15 +2542,16 @@ int dssset(int j, struct disprm *dis) +@@ -2544,15 +2625,16 @@ int dssset(int j, struct disprm *dis) struct wcserr **err; @@ -2407,7 +2766,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c dis->docorr[j] = 0; if (dis->Nhat[j] != 2) { -@@ -2560,15 +2559,15 @@ int dssset(int j, struct disprm *dis) +@@ -2560,15 +2642,15 @@ int dssset(int j, struct disprm *dis) "Axis map for %s must contain 2 entries, not %d", id, dis->Nhat[j]); } @@ -2426,7 +2785,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c niparm = I_NTPD; if ((dis->iparm[j] = calloc(niparm, sizeof(int))) == 0x0) { return wcserr_set(DIS_ERRMSG(DISERR_MEMORY)); -@@ -2576,29 +2575,29 @@ int dssset(int j, struct disprm *dis) +@@ -2576,29 +2658,29 @@ int dssset(int j, struct disprm *dis) ndparm = 6 + ncoeff; @@ -2463,7 +2822,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c A1 = A2 = A3 = 0.0; B1 = B2 = B3 = 0.0; keyp = dis->dp; -@@ -2639,7 +2638,7 @@ int dssset(int j, struct disprm *dis) +@@ -2639,7 +2721,7 @@ int dssset(int j, struct disprm *dis) "Coefficient scale for %s is zero.", id); } @@ -2472,7 +2831,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c dparm = dis->dparm[j]; if (j == 0) { dparm[0] = X0; -@@ -2649,7 +2648,7 @@ int dssset(int j, struct disprm *dis) +@@ -2649,7 +2731,7 @@ int dssset(int j, struct disprm *dis) dparm[4] = B2/S; dparm[5] = A1/S; @@ -2481,7 +2840,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c S *= -1.0; } else { -@@ -2661,7 +2660,7 @@ int dssset(int j, struct disprm *dis) +@@ -2661,7 +2743,7 @@ int dssset(int j, struct disprm *dis) dparm[5] = -A2/S; } @@ -2490,7 +2849,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c dparm += 6; degree = 3; keyp = dis->dp; -@@ -2671,13 +2670,13 @@ int dssset(int j, struct disprm *dis) +@@ -2671,13 +2753,13 @@ int dssset(int j, struct disprm *dis) fp = strchr(keyp->field, '.') + 1; if (strncmp(fp, "DSS.AMD.", 8) == 0) { @@ -2506,7 +2865,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c coeff /= S; if (m == 1) { -@@ -2725,8 +2724,8 @@ int dssset(int j, struct disprm *dis) +@@ -2725,8 +2807,8 @@ int dssset(int j, struct disprm *dis) } } @@ -2517,7 +2876,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (degree == 3) { dis->iparm[j][I_TPDNCO] = 12; dis->disp2x[j] = tpd3; -@@ -2735,7 +2734,7 @@ int dssset(int j, struct disprm *dis) +@@ -2735,7 +2817,7 @@ int dssset(int j, struct disprm *dis) return 0; } @@ -2526,7 +2885,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c #define CHEBYSHEV 1 #define LEGENDRE 2 -@@ -2766,15 +2765,16 @@ int watset(int j, struct disprm *dis) +@@ -2766,15 +2848,16 @@ int watset(int j, struct disprm *dis) struct wcserr **err; @@ -2546,7 +2905,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c dis->docorr[j] = 1; if (dis->Nhat[j] != 2) { -@@ -2782,7 +2782,7 @@ int watset(int j, struct disprm *dis) +@@ -2782,7 +2865,7 @@ int watset(int j, struct disprm *dis) "Axis map for %s must contain 2 entries, not %d", id, dis->Nhat[j]); } @@ -2555,7 +2914,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c degree = 1; kind = 0; xmin = xmax = 0.0; -@@ -2836,51 +2836,51 @@ int watset(int j, struct disprm *dis) +@@ -2836,51 +2919,51 @@ int watset(int j, struct disprm *dis) doaux = (kind == 1 || kind == 2); @@ -2619,7 +2978,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c niparm = I_NTPD; if ((dis->iparm[j] = calloc(niparm, sizeof(int))) == 0x0) { return wcserr_set(DIS_ERRMSG(DISERR_MEMORY)); -@@ -2890,23 +2890,23 @@ int watset(int j, struct disprm *dis) +@@ -2890,23 +2973,23 @@ int watset(int j, struct disprm *dis) ndparm = 6 + ncoeff; @@ -2648,7 +3007,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if ((dis->dparm[j] = calloc(ndparm, sizeof(double))) == 0x0) { return wcserr_set(DIS_ERRMSG(DISERR_MEMORY)); } -@@ -2914,7 +2914,7 @@ int watset(int j, struct disprm *dis) +@@ -2914,7 +2997,7 @@ int watset(int j, struct disprm *dis) dparm = dis->dparm[j]; @@ -2657,7 +3016,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (doaux) { x0 = (xmax + xmin)/2.0; dx = (xmax - xmin)/2.0; -@@ -2942,7 +2942,7 @@ int watset(int j, struct disprm *dis) +@@ -2942,7 +3025,7 @@ int watset(int j, struct disprm *dis) } @@ -2666,7 +3025,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c keyp = dis->dp; for (idp = 0; idp < dis->ndp; idp++, keyp++) { if (keyp->j-1 != j) continue; -@@ -2957,13 +2957,13 @@ int watset(int j, struct disprm *dis) +@@ -2957,13 +3040,13 @@ int watset(int j, struct disprm *dis) sscanf(fp, "%d_%d", &m, &n); if (kind == MONOMIAL) { @@ -2683,7 +3042,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c coeff = dpkeyd(keyp); cheleg(kind, m, n, coeffm, coeffn); -@@ -2984,9 +2984,9 @@ int watset(int j, struct disprm *dis) +@@ -2984,9 +3067,9 @@ int watset(int j, struct disprm *dis) return 0; } @@ -2696,7 +3055,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int cheleg(int kind, int m, int n, double coeffm[], double coeffn[]) -@@ -2996,7 +2996,7 @@ int cheleg(int kind, int m, int n, doubl +@@ -2996,7 +3079,7 @@ int cheleg(int kind, int m, int n, doubl N = (m > n) ? m : n; @@ -2705,7 +3064,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c coeff[0] = calloc(3*(N+1), sizeof(double)); coeff[1] = coeff[0] + (N+1); coeff[2] = coeff[1] + (N+1); -@@ -3011,7 +3011,7 @@ int cheleg(int kind, int m, int n, doubl +@@ -3011,7 +3094,7 @@ int cheleg(int kind, int m, int n, doubl coeff[1][1] = 1.0; } else { @@ -2714,7 +3073,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c j1 = (j-1)%3; j2 = (j-2)%3; -@@ -3038,7 +3038,7 @@ int cheleg(int kind, int m, int n, doubl +@@ -3038,7 +3121,7 @@ int cheleg(int kind, int m, int n, doubl return 0; } @@ -2723,7 +3082,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int dispoly( int dummy, -@@ -3054,10 +3054,10 @@ int dispoly( +@@ -3054,10 +3137,10 @@ int dispoly( const double *cptr, *dpolp, *pptr; double *aux, auxp0, *dvarpow, *dpowp, term, var; @@ -2736,7 +3095,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c for (jhat = 0; jhat < Nhat; jhat++) { if (rawcrd[jhat] == 0.0) { *discrd = 0.0; -@@ -3065,10 +3065,10 @@ int dispoly( +@@ -3065,10 +3148,10 @@ int dispoly( } } @@ -2749,7 +3108,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c for (k = 0; k < iparm[I_K]; k++) { cptr = dparm + k*iparm[I_NKPARM]; pptr = cptr + (1+Nhat); -@@ -3082,7 +3082,7 @@ int dispoly( +@@ -3082,7 +3165,7 @@ int dispoly( aux[k] = pow(aux[k], auxp0); @@ -2758,7 +3117,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (aux[k] == 0.0) { *discrd = 0.0; return 0; -@@ -3090,7 +3090,7 @@ int dispoly( +@@ -3090,7 +3173,7 @@ int dispoly( } @@ -2767,7 +3126,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c imaxpow = iparm + iparm[I_MAXPOW]; dvarpow = (double *)(dparm + iparm[I_DVPOW]); -@@ -3112,7 +3112,7 @@ int dispoly( +@@ -3112,7 +3195,7 @@ int dispoly( } } @@ -2776,7 +3135,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c *discrd = 0.0; iflgp = iparm + iparm[I_FLAGS]; ipowp = iparm + iparm[I_IPOW]; -@@ -3120,25 +3120,25 @@ int dispoly( +@@ -3120,25 +3203,25 @@ int dispoly( for (m = 0; m < iparm[I_M]; m++) { term = *(dpolp++); @@ -2808,7 +3167,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c term *= pow(dpowp[0], *dpolp); } -@@ -3156,7 +3156,7 @@ int dispoly( +@@ -3156,7 +3239,7 @@ int dispoly( return 0; } @@ -2817,7 +3176,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int tpd1( int inverse, -@@ -3176,7 +3176,7 @@ int tpd1( +@@ -3176,7 +3259,7 @@ int tpd1( u = rawcrd[0]; v = rawcrd[1]; @@ -2826,7 +3185,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDAUX]) { r = p[0] + p[1]*u + p[2]*v; v = p[3] + p[4]*u + p[5]*v; -@@ -3186,14 +3186,14 @@ int tpd1( +@@ -3186,14 +3269,14 @@ int tpd1( if (inverse) p += i[I_TPDNCO]; @@ -2843,7 +3202,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDRAD]) { s = u*u + v*v; r = sqrt(s); -@@ -3204,7 +3204,7 @@ int tpd1( +@@ -3204,7 +3287,7 @@ int tpd1( return 0; } @@ -2852,7 +3211,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int tpd2( int inverse, -@@ -3224,7 +3224,7 @@ int tpd2( +@@ -3224,7 +3307,7 @@ int tpd2( u = rawcrd[0]; v = rawcrd[1]; @@ -2861,7 +3220,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDAUX]) { r = p[0] + p[1]*u + p[2]*v; v = p[3] + p[4]*u + p[5]*v; -@@ -3234,7 +3234,7 @@ int tpd2( +@@ -3234,7 +3317,7 @@ int tpd2( if (inverse) p += i[I_TPDNCO]; @@ -2870,7 +3229,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c *discrd = p[0] + u*(p[1] + u*(p[4])); if (Nhat == 1) return 0; -@@ -3243,7 +3243,7 @@ int tpd2( +@@ -3243,7 +3326,7 @@ int tpd2( v*(p[2] + v*(p[6])) + u*(p[5])*v; @@ -2879,7 +3238,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDRAD]) { s = u*u + v*v; r = sqrt(s); -@@ -3254,7 +3254,7 @@ int tpd2( +@@ -3254,7 +3337,7 @@ int tpd2( return 0; } @@ -2888,7 +3247,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int tpd3( int inverse, -@@ -3274,7 +3274,7 @@ int tpd3( +@@ -3274,7 +3357,7 @@ int tpd3( u = rawcrd[0]; v = rawcrd[1]; @@ -2897,7 +3256,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDAUX]) { r = p[0] + p[1]*u + p[2]*v; v = p[3] + p[4]*u + p[5]*v; -@@ -3284,7 +3284,7 @@ int tpd3( +@@ -3284,7 +3367,7 @@ int tpd3( if (inverse) p += i[I_TPDNCO]; @@ -2906,7 +3265,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c *discrd = p[0] + u*(p[1] + u*(p[4] + u*(p[7]))); if (Nhat == 1) return 0; -@@ -3294,7 +3294,7 @@ int tpd3( +@@ -3294,7 +3377,7 @@ int tpd3( + u*(p[5] + v*(p[9]) + u*(p[8]))*v; @@ -2915,7 +3274,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDRAD]) { s = u*u + v*v; r = sqrt(s); -@@ -3305,7 +3305,7 @@ int tpd3( +@@ -3305,7 +3388,7 @@ int tpd3( return 0; } @@ -2924,7 +3283,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int tpd4( int inverse, -@@ -3325,7 +3325,7 @@ int tpd4( +@@ -3325,7 +3408,7 @@ int tpd4( u = rawcrd[0]; v = rawcrd[1]; @@ -2933,7 +3292,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDAUX]) { r = p[0] + p[1]*u + p[2]*v; v = p[3] + p[4]*u + p[5]*v; -@@ -3335,7 +3335,7 @@ int tpd4( +@@ -3335,7 +3418,7 @@ int tpd4( if (inverse) p += i[I_TPDNCO]; @@ -2942,7 +3301,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c *discrd = p[0] + u*(p[1] + u*(p[4] + u*(p[7] + u*(p[12])))); if (Nhat == 1) return 0; -@@ -3346,7 +3346,7 @@ int tpd4( +@@ -3346,7 +3429,7 @@ int tpd4( + u*(p[8] + v*(p[14]) + u*(p[13])))*v; @@ -2951,7 +3310,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDRAD]) { s = u*u + v*v; r = sqrt(s); -@@ -3357,7 +3357,7 @@ int tpd4( +@@ -3357,7 +3440,7 @@ int tpd4( return 0; } @@ -2960,7 +3319,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int tpd5( int inverse, -@@ -3377,7 +3377,7 @@ int tpd5( +@@ -3377,7 +3460,7 @@ int tpd5( u = rawcrd[0]; v = rawcrd[1]; @@ -2969,7 +3328,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDAUX]) { r = p[0] + p[1]*u + p[2]*v; v = p[3] + p[4]*u + p[5]*v; -@@ -3387,7 +3387,7 @@ int tpd5( +@@ -3387,7 +3470,7 @@ int tpd5( if (inverse) p += i[I_TPDNCO]; @@ -2978,7 +3337,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c *discrd = p[0] + u*(p[1] + u*(p[4] + u*(p[7] + u*(p[12] + u*(p[17]))))); if (Nhat == 1) return 0; -@@ -3399,7 +3399,7 @@ int tpd5( +@@ -3399,7 +3482,7 @@ int tpd5( + u*(p[13] + v*(p[19]) + u*(p[18]))))*v; @@ -2987,7 +3346,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDRAD]) { s = u*u + v*v; r = sqrt(s); -@@ -3410,7 +3410,7 @@ int tpd5( +@@ -3410,7 +3493,7 @@ int tpd5( return 0; } @@ -2996,7 +3355,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int tpd6( int inverse, -@@ -3430,7 +3430,7 @@ int tpd6( +@@ -3430,7 +3513,7 @@ int tpd6( u = rawcrd[0]; v = rawcrd[1]; @@ -3005,7 +3364,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDAUX]) { r = p[0] + p[1]*u + p[2]*v; v = p[3] + p[4]*u + p[5]*v; -@@ -3440,7 +3440,7 @@ int tpd6( +@@ -3440,7 +3523,7 @@ int tpd6( if (inverse) p += i[I_TPDNCO]; @@ -3014,7 +3373,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c *discrd = p[0] + u*(p[1] + u*(p[4] + u*(p[7] + u*(p[12] + u*(p[17] + u*(p[24])))))); if (Nhat == 1) return 0; -@@ -3453,7 +3453,7 @@ int tpd6( +@@ -3453,7 +3536,7 @@ int tpd6( + u*(p[18] + v*(p[26]) + u*(p[25])))))*v; @@ -3023,7 +3382,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDRAD]) { s = u*u + v*v; r = sqrt(s); -@@ -3464,7 +3464,7 @@ int tpd6( +@@ -3464,7 +3547,7 @@ int tpd6( return 0; } @@ -3032,7 +3391,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int tpd7( int inverse, -@@ -3484,7 +3484,7 @@ int tpd7( +@@ -3484,7 +3567,7 @@ int tpd7( u = rawcrd[0]; v = rawcrd[1]; @@ -3041,7 +3400,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDAUX]) { r = p[0] + p[1]*u + p[2]*v; v = p[3] + p[4]*u + p[5]*v; -@@ -3494,7 +3494,7 @@ int tpd7( +@@ -3494,7 +3577,7 @@ int tpd7( if (inverse) p += i[I_TPDNCO]; @@ -3050,7 +3409,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c *discrd = p[0] + u*(p[1] + u*(p[4] + u*(p[7] + u*(p[12] + u*(p[17] + u*(p[24] + u*(p[31]))))))); if (Nhat == 1) return 0; -@@ -3508,7 +3508,7 @@ int tpd7( +@@ -3508,7 +3591,7 @@ int tpd7( + u*(p[25] + v*(p[33]) + u*(p[32]))))))*v; @@ -3059,7 +3418,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDRAD]) { s = u*u + v*v; r = sqrt(s); -@@ -3519,7 +3519,7 @@ int tpd7( +@@ -3519,7 +3602,7 @@ int tpd7( return 0; } @@ -3068,7 +3427,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int tpd8( int inverse, -@@ -3539,7 +3539,7 @@ int tpd8( +@@ -3539,7 +3622,7 @@ int tpd8( u = rawcrd[0]; v = rawcrd[1]; @@ -3077,7 +3436,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDAUX]) { r = p[0] + p[1]*u + p[2]*v; v = p[3] + p[4]*u + p[5]*v; -@@ -3549,7 +3549,7 @@ int tpd8( +@@ -3549,7 +3632,7 @@ int tpd8( if (inverse) p += i[I_TPDNCO]; @@ -3086,7 +3445,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c *discrd = p[0] + u*(p[1] + u*(p[4] + u*(p[7] + u*(p[12] + u*(p[17] + u*(p[24] + u*(p[31] + u*(p[40])))))))); if (Nhat == 1) return 0; -@@ -3564,7 +3564,7 @@ int tpd8( +@@ -3564,7 +3647,7 @@ int tpd8( + u*(p[32] + v*(p[42]) + u*(p[41])))))))*v; @@ -3095,7 +3454,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDRAD]) { s = u*u + v*v; r = sqrt(s); -@@ -3575,7 +3575,7 @@ int tpd8( +@@ -3575,7 +3658,7 @@ int tpd8( return 0; } @@ -3104,7 +3463,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c int tpd9( int inverse, -@@ -3595,7 +3595,7 @@ int tpd9( +@@ -3595,7 +3678,7 @@ int tpd9( u = rawcrd[0]; v = rawcrd[1]; @@ -3113,7 +3472,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDAUX]) { r = p[0] + p[1]*u + p[2]*v; v = p[3] + p[4]*u + p[5]*v; -@@ -3605,7 +3605,7 @@ int tpd9( +@@ -3605,7 +3688,7 @@ int tpd9( if (inverse) p += i[I_TPDNCO]; @@ -3122,7 +3481,7 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c *discrd = p[0] + u*(p[1] + u*(p[4] + u*(p[7] + u*(p[12] + u*(p[17] + u*(p[24] + u*(p[31] + u*(p[40] + u*(p[49]))))))))); if (Nhat == 1) return 0; -@@ -3621,7 +3621,7 @@ int tpd9( +@@ -3621,7 +3704,7 @@ int tpd9( + u*(p[41] + v*(p[51]) + u*(p[50]))))))))*v; @@ -3131,16 +3490,16 @@ Index: astropy-4.2/cextern/wcslib/C/dis.c if (i[I_TPDRAD]) { s = u*u + v*v; r = sqrt(s); -Index: astropy-4.2/cextern/wcslib/C/dis.h +Index: astropy-4.2.1/cextern/wcslib/C/dis.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/dis.h -+++ astropy-4.2/cextern/wcslib/C/dis.h +--- astropy-4.2.1.orig/cextern/wcslib/C/dis.h ++++ astropy-4.2.1/cextern/wcslib/C/dis.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -3154,11 +3513,11 @@ Index: astropy-4.2/cextern/wcslib/C/dis.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: dis.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: dis.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: dis.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * @@ -3211,7 +3570,53 @@ Index: astropy-4.2/cextern/wcslib/C/dis.h * Summary of the dis routines: * ---------------------------- * These routines apply the distortion functions defined by the extension to -@@ -1010,88 +1028,88 @@ extern "C" { +@@ -319,7 +337,8 @@ + * dpfill(), dpkeyi(), and dpkeyd() are provided to manage the dpkey struct. + * + * disndp(), disini(), disinit(), discpy(), and disfree() are provided to +-* manage the disprm struct, and another, disprt(), prints its contents. ++* manage the disprm struct, dissize() computes its total size including ++* allocated memory, and disprt() prints its contents. + * + * disperr() prints the error message(s) (if any) stored in a disprm struct. + * +@@ -545,6 +564,35 @@ + * 1: Null disprm pointer passed. + * + * ++* dissize() - Compute the size of a disprm struct ++* ----------------------------------------------- ++* dissize() computes the full size of a disprm struct, including allocated ++* memory. ++* ++* Given: ++* dis const struct disprm* ++* Distortion function parameters. ++* ++* If NULL, the base size of the struct and the allocated ++* size are both set to zero. ++* ++* Returned: ++* sizes int[2] The first element is the base size of the struct as ++* returned by sizeof(struct disprm). The second element ++* is the total allocated size, in bytes, assuming that ++* the allocation was done by disini(). This figure ++* includes memory allocated for members of constituent ++* structs, such as disprm::dp. ++* ++* It is not an error for the struct not to have been set ++* up via tabset(), which normally results in additional ++* memory allocation. ++* ++* Function return value: ++* int Status return value: ++* 0: Success. ++* ++* + * disprt() - Print routine for the disprm struct + * ---------------------------------------------- + * disprt() prints the contents of a disprm struct using wcsprintf(). Mainly +@@ -1010,88 +1058,88 @@ extern "C" { extern const char *dis_errmsg[]; enum dis_errmsg_enum { @@ -3354,22 +3759,31 @@ Index: astropy-4.2/cextern/wcslib/C/dis.h #define DISLEN (sizeof(struct disprm)/sizeof(int)) -@@ -1134,4 +1152,4 @@ int diswarp(struct disprm *dis, const do +@@ -1112,6 +1160,8 @@ int discpy(int alloc, const struct dispr + + int disfree(struct disprm *dis); + ++int dissize(const struct disprm *dis, int sizes[2]); ++ + int disprt(const struct disprm *dis); + + int disperr(const struct disprm *dis, const char *prefix); +@@ -1134,4 +1184,4 @@ int diswarp(struct disprm *dis, const do } #endif -#endif /* WCSLIB_DIS */ +#endif // WCSLIB_DIS -Index: astropy-4.2/cextern/wcslib/C/fitshdr.h +Index: astropy-4.2.1/cextern/wcslib/C/fitshdr.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/fitshdr.h -+++ astropy-4.2/cextern/wcslib/C/fitshdr.h +--- astropy-4.2.1.orig/cextern/wcslib/C/fitshdr.h ++++ astropy-4.2.1/cextern/wcslib/C/fitshdr.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -3383,15 +3797,23 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: fitshdr.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: fitshdr.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: fitshdr.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * -@@ -384,17 +381,17 @@ extern "C" { +@@ -96,6 +93,7 @@ + * 1: Null fitskey pointer passed. + * 2: Memory allocation failed. + * 3: Fatal error returned by Flex parser. ++* 4: Unrecognised data type. + * + * Notes: + * 1: Keyword parsing is done in accordance with the syntax defined by +@@ -384,17 +382,18 @@ extern "C" { #define FITSHDR_KEYVALUE 0x02 #define FITSHDR_COMMENT 0x04 #define FITSHDR_KEYREC 0x08 @@ -3410,11 +3832,12 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.h + FITSHDRERR_SUCCESS = 0, // Success. + FITSHDRERR_NULL_POINTER = 1, // Null fitskey pointer passed. + FITSHDRERR_MEMORY = 2, // Memory allocation failed. -+ FITSHDRERR_FLEX_PARSER = 3 // Fatal error returned by Flex parser. ++ FITSHDRERR_FLEX_PARSER = 3, // Fatal error returned by Flex parser. ++ FITSHDRERR_DATA_TYPE = 4 // Unrecognised data type. }; #ifdef WCSLIB_INT64 -@@ -404,38 +401,38 @@ enum fitshdr_errmsg_enum { +@@ -404,38 +403,38 @@ enum fitshdr_errmsg_enum { #endif @@ -3475,22 +3898,22 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.h #define KEYLEN (sizeof(struct fitskey)/sizeof(int)) -@@ -447,4 +444,4 @@ int fitshdr(const char header[], int nke +@@ -447,4 +446,4 @@ int fitshdr(const char header[], int nke } #endif -#endif /* WCSLIB_FITSHDR */ +#endif // WCSLIB_FITSHDR -Index: astropy-4.2/cextern/wcslib/C/fitshdr.l +Index: astropy-4.2.1/cextern/wcslib/C/fitshdr.l =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/fitshdr.l -+++ astropy-4.2/cextern/wcslib/C/fitshdr.l +--- astropy-4.2.1.orig/cextern/wcslib/C/fitshdr.l ++++ astropy-4.2.1/cextern/wcslib/C/fitshdr.l @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -3504,74 +3927,186 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: fitshdr.l,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: fitshdr.l,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: fitshdr.l,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * * fitshdr.l is a Flex description file containing a lexical scanner -@@ -88,7 +85,7 @@ static int fitshdr_scanner(const char he - struct fitskeyid keyids[], int *nreject, \ - struct fitskey **keys, yyscan_t yyscanner); +@@ -44,6 +41,7 @@ + %option outfile="fitshdr.c" + %option prefix="fitshdr" + %option reentrant ++%option extra-type="struct fitshdr_extra *" + /* Keywords. */ + KEYCHR [-_A-Z0-9] +@@ -84,35 +82,15 @@ UNITSTR \[[-+*/^(). 0-9a-zA-Z]+\] + #include "fitshdr.h" + #include "wcsutil.h" + +-static int fitshdr_scanner(const char header[], int nkeyrec, int nkeyids, \ +- struct fitskeyid keyids[], int *nreject, \ +- struct fitskey **keys, yyscan_t yyscanner); +- -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- - - int fitshdr( - const char header[], -@@ -112,7 +109,7 @@ int fitshdr( - return status; - } - +- +-int fitshdr( +- const char header[], +- int nkeyrec, +- int nkeyids, +- struct fitskeyid keyids[], +- int *nreject, +- struct fitskey **keys) +- +-{ +- int status; +- yyscan_t yyscanner; +- int yylex_init(yyscan_t *yyscanner); +- int yylex_destroy(yyscan_t yyscanner); +- +- yylex_init(&yyscanner); +- status = fitshdr_scanner(header, nkeyrec, nkeyids, keyids, nreject, +- keys, yyscanner); +- yylex_destroy(yyscanner); +- +- return status; +-} +- -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- ++// User data associated with yyscanner. ++struct fitshdr_extra { ++ // Values passed to YY_INPUT. ++ const char *hdr; ++ int nkeyrec; ++ ++ // Used in preempting the call to exit() by yy_fatal_error(). ++ jmp_buf abort_jmp_env; ++}; #define YY_DECL int fitshdr_scanner(const char header[], int nkeyrec, \ int nkeyids, struct fitskeyid keyids[], int *nreject, \ -@@ -131,15 +128,15 @@ int fitshdr( +@@ -120,26 +98,25 @@ int fitshdr( + + #define YY_INPUT(inbuff, count, bufsize) \ + { \ +- if (fitshdr_nkeyrec) { \ +- strncpy(inbuff, fitshdr_hdr, 80); \ ++ if (yyextra->nkeyrec) { \ ++ strncpy(inbuff, yyextra->hdr, 80); \ + inbuff[80] = '\n'; \ +- fitshdr_hdr += 80; \ +- fitshdr_nkeyrec--; \ ++ yyextra->hdr += 80; \ ++ yyextra->nkeyrec--; \ + count = 81; \ + } else { \ + count = YY_NULL; \ } \ } -/* These global variables are required by YY_INPUT. */ -+// These global variables are required by YY_INPUT. - const char *fitshdr_hdr; - int fitshdr_nkeyrec; - +-const char *fitshdr_hdr; +-int fitshdr_nkeyrec; +- -/* Used in preempting the call to exit() by yy_fatal_error(). */ -+// Used in preempting the call to exit() by yy_fatal_error(). - jmp_buf fitshdr_abort_jmp_env; - #define exit(status) longjmp(fitshdr_abort_jmp_env, status) +-jmp_buf fitshdr_abort_jmp_env; +-#define exit(status) longjmp(fitshdr_abort_jmp_env, status) ++// Preempt the call to exit() by yy_fatal_error(). ++#define exit(status) longjmp(yyextra->abort_jmp_env, status); -/* Map status return value to message. */ ++// Internal helper functions. ++static YY_DECL; ++static void nullfill(char cptr[], int len); ++ +// Map status return value to message. const char *fitshdr_errmsg[] = { "Success", "Null fitskey pointer-pointer passed", -@@ -166,13 +163,13 @@ const char *fitshdr_errmsg[] = { - return 1; +@@ -149,50 +126,65 @@ const char *fitshdr_errmsg[] = { + %} + + %% +- char *cptr, ctmp[72]; +- int blank, continuation, end, j, k, keyno; +- double dtmp; +- struct fitskey *kptr; +- struct fitskeyid *iptr; +- void nullfill(char cptr[], int len); +- +- fitshdr_hdr = header; +- fitshdr_nkeyrec = nkeyrec; +- +- *nreject = 0; +- keyno = 0; ++ char ctmp[72]; + + if (keys == 0x0) { +- return 1; ++ return FITSHDRERR_NULL_POINTER; } - /* Allocate memory for the required number of fitskey structs. */ - /* Recall that calloc() initializes allocated memory to zero. */ + // Allocate memory for the required number of fitskey structs. + // Recall that calloc() initializes allocated memory to zero. ++ struct fitskey *kptr; if (!(kptr = *keys = calloc(nkeyrec, sizeof(struct fitskey)))) { - return 2; +- return 2; ++ return FITSHDRERR_MEMORY; } - /* Initialize keyids[]. */ +- iptr = keyids; +- for (j = 0; j < nkeyids; j++, iptr++) { ++ // Initialize returned values. ++ *nreject = 0; ++ + // Initialize keyids[]. - iptr = keyids; - for (j = 0; j < nkeyids; j++, iptr++) { ++ struct fitskeyid *iptr = keyids; ++ for (int j = 0; j < nkeyids; j++, iptr++) { iptr->count = 0; -@@ -184,7 +181,7 @@ const char *fitshdr_errmsg[] = { - continuation = 0; - end = 0; - -- /* Return here via longjmp() invoked by yy_fatal_error(). */ -+ // Return here via longjmp() invoked by yy_fatal_error(). - if (setjmp(fitshdr_abort_jmp_env)) { - return 3; + iptr->idx[0] = -1; + iptr->idx[1] = -1; } -@@ -192,7 +189,7 @@ const char *fitshdr_errmsg[] = { ++ ++ int keyno = 0; ++ ++ int blank = 0; ++ int continuation = 0; ++ int end = 0; ++ ++ #ifdef WCSLIB_INT64 ++ #define asString(S) stringize(S) ++ #define stringize(S) #S ++ ++ const char *int64fmt; ++ if (strcmp(asString(WCSLIB_INT64), "long long int") == 0) { ++ int64fmt = "%lld"; ++ } else if (strcmp(asString(WCSLIB_INT64), "long int") == 0) { ++ int64fmt = "%ld"; ++ } else if (strcmp(asString(WCSLIB_INT64), "int") == 0) { ++ int64fmt = "%d"; ++ } else { ++ return FITSHDRERR_DATA_TYPE; ++ } ++ #endif ++ ++ // User data associated with yyscanner. ++ yyextra->hdr = header; ++ yyextra->nkeyrec = nkeyrec; + +- blank = 0; +- continuation = 0; +- end = 0; +- +- /* Return here via longjmp() invoked by yy_fatal_error(). */ +- if (setjmp(fitshdr_abort_jmp_env)) { +- return 3; ++ // Return here via longjmp() invoked by yy_fatal_error(). ++ if (setjmp(yyextra->abort_jmp_env)) { ++ return FITSHDRERR_FLEX_PARSER; + } + BEGIN(INITIAL); ^" "{80} { @@ -3580,7 +4115,7 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l strncpy(kptr->keyword, yytext, 8); yyless(0); blank = 1; -@@ -211,14 +208,14 @@ const char *fitshdr_errmsg[] = { +@@ -211,14 +203,14 @@ const char *fitshdr_errmsg[] = { } ^END" "{5}=" "+ { @@ -3597,7 +4132,7 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l strncpy(kptr->keyword, yytext, 8); kptr->status |= FITSHDR_KEYREC; BEGIN(COMMENT); -@@ -230,57 +227,57 @@ const char *fitshdr_errmsg[] = { +@@ -230,57 +222,58 @@ const char *fitshdr_errmsg[] = { } ^CONTINUE" "+{STRING} { @@ -3608,6 +4143,7 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l if (keyno > 0 && (kptr-1)->type%10 == 8) { - /* Put back the string keyvalue. */ + // Put back the string keyvalue. ++ int k; for (k = 10; yytext[k] != '\''; k++); yyless(k); continuation = 1; @@ -3664,12 +4200,13 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l kptr->type = 2; if (sscanf(yytext, "%d", &(kptr->keyvalue.i)) < 1) { kptr->status |= FITSHDR_KEYVALUE; -@@ -291,13 +288,13 @@ const char *fitshdr_errmsg[] = { +@@ -291,13 +284,14 @@ const char *fitshdr_errmsg[] = { } {INT64} { - /* 64-bit signed integer keyvalue (up to 18 digits). */ + // 64-bit signed integer keyvalue (up to 18 digits). ++ double dtmp; if (wcsutil_str2double(yytext, &dtmp)) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); @@ -3680,7 +4217,7 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l kptr->type = 2; if (sscanf(yytext, "%d", &(kptr->keyvalue.i)) < 1) { kptr->status |= FITSHDR_KEYVALUE; -@@ -305,16 +302,16 @@ const char *fitshdr_errmsg[] = { +@@ -305,16 +299,16 @@ const char *fitshdr_errmsg[] = { } } else { @@ -3689,8 +4226,9 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l kptr->type = 3; #ifdef WCSLIB_INT64 - /* Native 64-bit integer is available. */ +- if (sscanf(yytext, "%lld", &(kptr->keyvalue.k)) < 1) { + // Native 64-bit integer is available. - if (sscanf(yytext, "%lld", &(kptr->keyvalue.k)) < 1) { ++ if (sscanf(yytext, int64fmt, &(kptr->keyvalue.k)) < 1) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } @@ -3700,7 +4238,7 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l kptr->keyvalue.k[2] = 0; sprintf(ctmp, "%%%dd%%9d", yyleng-9); -@@ -332,12 +329,12 @@ const char *fitshdr_errmsg[] = { +@@ -332,12 +326,12 @@ const char *fitshdr_errmsg[] = { } {INTVL} { @@ -3708,14 +4246,15 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l + // Very long integer keyvalue (and 19-digit int64). kptr->type = 4; strcpy(ctmp, yytext); - k = yyleng; +- k = yyleng; ++ int j, k = yyleng; for (j = 0; j < 8; j++) { - /* Read it backwards. */ + // Read it backwards. k -= 9; if (k < 0) k = 0; if (sscanf(ctmp+k, "%d", kptr->keyvalue.l+j) < 1) { -@@ -352,7 +349,7 @@ const char *fitshdr_errmsg[] = { +@@ -352,7 +346,7 @@ const char *fitshdr_errmsg[] = { ctmp[k] = '\0'; } @@ -3724,16 +4263,19 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l if (j == 2 && abs(kptr->keyvalue.l[2]) <= 9 && abs(kptr->keyvalue.l[1]) <= 223372036 && kptr->keyvalue.l[0] <= 854775807 && -@@ -360,7 +357,7 @@ const char *fitshdr_errmsg[] = { +@@ -360,9 +354,9 @@ const char *fitshdr_errmsg[] = { kptr->type = 3; #ifdef WCSLIB_INT64 - /* Native 64-bit integer is available. */ + // Native 64-bit integer is available. kptr->keyvalue.l[2] = 0; - if (sscanf(yytext, "%lld", &(kptr->keyvalue.k)) < 1) { +- if (sscanf(yytext, "%lld", &(kptr->keyvalue.k)) < 1) { ++ if (sscanf(yytext, int64fmt, &(kptr->keyvalue.k)) < 1) { kptr->status |= FITSHDR_KEYVALUE; -@@ -373,7 +370,7 @@ const char *fitshdr_errmsg[] = { + BEGIN(ERROR); + } +@@ -373,7 +367,7 @@ const char *fitshdr_errmsg[] = { } {FLOAT} { @@ -3742,7 +4284,7 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l kptr->type = 5; if (wcsutil_str2double(yytext, &(kptr->keyvalue.f))) { kptr->status |= FITSHDR_KEYVALUE; -@@ -384,7 +381,7 @@ const char *fitshdr_errmsg[] = { +@@ -384,7 +378,7 @@ const char *fitshdr_errmsg[] = { } {ICOMPLX} { @@ -3751,7 +4293,7 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l kptr->type = 6; if (sscanf(yytext, "(%lf,%lf)", kptr->keyvalue.c, kptr->keyvalue.c+1) < 2) { -@@ -396,7 +393,7 @@ const char *fitshdr_errmsg[] = { +@@ -396,9 +390,11 @@ const char *fitshdr_errmsg[] = { } {FCOMPLX} { @@ -3759,23 +4301,32 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l + // Floating point complex keyvalue. kptr->type = 7; ++ char *cptr; ++ int k; for (cptr = ctmp, k = 1; yytext[k] != ','; cptr++, k++) { -@@ -423,12 +420,12 @@ const char *fitshdr_errmsg[] = { + *cptr = yytext[k]; + } +@@ -423,14 +419,14 @@ const char *fitshdr_errmsg[] = { } {STRING} { - /* String keyvalue. */ + // String keyvalue. kptr->type = 8; - cptr = kptr->keyvalue.s; +- cptr = kptr->keyvalue.s; ++ char *cptr = kptr->keyvalue.s; strcpy(cptr, yytext+1); - /* Squeeze out repeated quotes. */ +- k = 0; +- for (j = 0; j < 72; j++) { + // Squeeze out repeated quotes. - k = 0; - for (j = 0; j < 72; j++) { ++ int k = 0; ++ for (int j = 0; j < 72; j++) { if (k < j) { -@@ -446,7 +443,7 @@ const char *fitshdr_errmsg[] = { + cptr[k] = cptr[j]; + } +@@ -446,7 +442,7 @@ const char *fitshdr_errmsg[] = { } if (*cptr) { @@ -3784,7 +4335,7 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l nullfill(cptr+1, 71); } else { nullfill(cptr, 72); -@@ -478,7 +475,7 @@ const char *fitshdr_errmsg[] = { +@@ -478,7 +474,7 @@ const char *fitshdr_errmsg[] = { } . { @@ -3793,7 +4344,16 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l kptr->status |= FITSHDR_COMMENT; kptr->type = 0; BEGIN(ERROR); -@@ -512,14 +509,14 @@ const char *fitshdr_errmsg[] = { +@@ -504,7 +500,7 @@ const char *fitshdr_errmsg[] = { + .* { + if (!continuation) kptr->type = -abs(kptr->type); + +- sprintf(kptr->comment, "%.80s", fitshdr_hdr-80); ++ sprintf(kptr->comment, "%.80s", yyextra->hdr-80); + kptr->comment[80] = '\0'; + nullfill(kptr->comment+80, 4); + +@@ -512,18 +508,19 @@ const char *fitshdr_errmsg[] = { } .*\n { @@ -3810,7 +4370,14 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l + // Do indexing. iptr = keyids; kptr->keyid = -1; - for (j = 0; j < nkeyids; j++, iptr++) { +- for (j = 0; j < nkeyids; j++, iptr++) { +- cptr = iptr->name; ++ for (int j = 0; j < nkeyids; j++, iptr++) { ++ int k; ++ char *cptr = iptr->name; + cptr[8] = '\0'; + nullfill(cptr, 12); + for (k = 0; k < 8; k++, cptr++) { @@ -531,7 +528,7 @@ const char *fitshdr_errmsg[] = { } @@ -3820,7 +4387,7 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l iptr->count++; if (iptr->idx[0] == -1) { iptr->idx[0] = keyno-1; -@@ -544,9 +541,9 @@ const char *fitshdr_errmsg[] = { +@@ -544,17 +541,17 @@ const char *fitshdr_errmsg[] = { } } @@ -3830,9 +4397,10 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l - /* Tidy up the previous string keyvalue. */ + // Tidy up the previous string keyvalue. if ((kptr-1)->type == 8) (kptr-1)->type += 10; - cptr = (kptr-1)->keyvalue.s; +- cptr = (kptr-1)->keyvalue.s; ++ char *cptr = (kptr-1)->keyvalue.s; if (cptr[strlen(cptr)-1] == '&') cptr[strlen(cptr)-1] = '\0'; -@@ -554,7 +551,7 @@ const char *fitshdr_errmsg[] = { + kptr->type = (kptr-1)->type + 10; } @@ -3841,7 +4409,7 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l if (end && (end++ > 1) && !blank) { kptr->status |= FITSHDR_TRAILER; } -@@ -568,20 +565,20 @@ const char *fitshdr_errmsg[] = { +@@ -568,30 +565,59 @@ const char *fitshdr_errmsg[] = { } <> { @@ -3853,22 +4421,65 @@ Index: astropy-4.2/cextern/wcslib/C/fitshdr.l %% -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- ++/*---------------------------------------------------------------------------- ++* External interface to the scanner. ++*---------------------------------------------------------------------------*/ - void nullfill(char cptr[], int len) +-void nullfill(char cptr[], int len) ++int fitshdr( ++ const char header[], ++ int nkeyrec, ++ int nkeyids, ++ struct fitskeyid keyids[], ++ int *nreject, ++ struct fitskey **keys) { - int j, k; +- int j, k; ++ // Function prototypes. ++ int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner); ++ int yylex_destroy(yyscan_t yyscanner); - /* Null-fill the string. */ -+ // Null-fill the string. ++ struct fitshdr_extra extra; ++ yyscan_t yyscanner; ++ yylex_init_extra(&extra, &yyscanner); ++ int status = fitshdr_scanner(header, nkeyrec, nkeyids, keyids, nreject, ++ keys, yyscanner); ++ yylex_destroy(yyscanner); ++ ++ return status; ++} ++ ++/*---------------------------------------------------------------------------- ++* Pad a string with null characters. ++*---------------------------------------------------------------------------*/ ++ ++void nullfill(char cptr[], int len) ++ ++{ ++ // Propagate the terminating null to the end of the string. ++ int j; for (j = 0; j < len; j++) { if (cptr[j] == '\0') { - for (k = j+1; k < len; k++) { -Index: astropy-4.2/cextern/wcslib/C/flexed/README +- for (k = j+1; k < len; k++) { ++ for (int k = j+1; k < len; k++) { + cptr[k] = '\0'; + } + break; + } + } + +- for (k = j-1; k >= 0; k--) { ++ // Remove trailing blanks. ++ for (int k = j-1; k >= 0; k--) { + if (cptr[k] != ' ') break; + cptr[k] = '\0'; + } +Index: astropy-4.2.1/cextern/wcslib/C/flexed/README =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/flexed/README -+++ astropy-4.2/cextern/wcslib/C/flexed/README +--- astropy-4.2.1.orig/cextern/wcslib/C/flexed/README ++++ astropy-4.2.1/cextern/wcslib/C/flexed/README @@ -1,5 +1,5 @@ This directory contains C code generated by flex 2.6.4 under KDE Neon User -Edition 5.17 (Kubuntu 18.04) from the Flex description files (*.l) in the @@ -3876,10 +4487,10 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/README parent directory. These pre-generated source files may be used during installation if -Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c +Index: astropy-4.2.1/cextern/wcslib/C/flexed/fitshdr.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/flexed/fitshdr.c -+++ astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c +--- astropy-4.2.1.orig/cextern/wcslib/C/flexed/fitshdr.c ++++ astropy-4.2.1/cextern/wcslib/C/flexed/fitshdr.c @@ -10233,9 +10233,8 @@ static const yy_state_type yy_NUL_trans[ #define YY_RESTORE_YY_MORE_OFFSET #line 1 "fitshdr.l" @@ -3887,7 +4498,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -3901,7 +4512,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: fitshdr.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: fitshdr.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: fitshdr.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * * fitshdr.l is a Flex description file containing a lexical scanner @@ -3910,43 +4521,89 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c /* Exclusive start states. */ -#line 78 "fitshdr.l" -+#line 75 "fitshdr.l" ++#line 76 "fitshdr.l" #include #include #include -@@ -10289,7 +10286,7 @@ static int fitshdr_scanner(const char he - struct fitskeyid keyids[], int *nreject, \ - struct fitskey **keys, yyscan_t yyscanner); +@@ -10285,35 +10282,15 @@ static const yy_state_type yy_NUL_trans[ + #include "fitshdr.h" + #include "wcsutil.h" +-static int fitshdr_scanner(const char header[], int nkeyrec, int nkeyids, \ +- struct fitskeyid keyids[], int *nreject, \ +- struct fitskey **keys, yyscan_t yyscanner); +- -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- - - int fitshdr( - const char header[], -@@ -10313,7 +10310,7 @@ int fitshdr( - return status; - } - +- +-int fitshdr( +- const char header[], +- int nkeyrec, +- int nkeyids, +- struct fitskeyid keyids[], +- int *nreject, +- struct fitskey **keys) +- +-{ +- int status; +- yyscan_t yyscanner; +- int yylex_init(yyscan_t *yyscanner); +- int yylex_destroy(yyscan_t yyscanner); +- +- yylex_init(&yyscanner); +- status = fitshdr_scanner(header, nkeyrec, nkeyids, keyids, nreject, +- keys, yyscanner); +- yylex_destroy(yyscanner); +- +- return status; +-} +- -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- ++// User data associated with yyscanner. ++struct fitshdr_extra { ++ // Values passed to YY_INPUT. ++ const char *hdr; ++ int nkeyrec; ++ ++ // Used in preempting the call to exit() by yy_fatal_error(). ++ jmp_buf abort_jmp_env; ++}; #define YY_DECL int fitshdr_scanner(const char header[], int nkeyrec, \ int nkeyids, struct fitskeyid keyids[], int *nreject, \ -@@ -10332,23 +10329,23 @@ int fitshdr( +@@ -10321,34 +10298,33 @@ int fitshdr( + + #define YY_INPUT(inbuff, count, bufsize) \ + { \ +- if (fitshdr_nkeyrec) { \ +- strncpy(inbuff, fitshdr_hdr, 80); \ ++ if (yyextra->nkeyrec) { \ ++ strncpy(inbuff, yyextra->hdr, 80); \ + inbuff[80] = '\n'; \ +- fitshdr_hdr += 80; \ +- fitshdr_nkeyrec--; \ ++ yyextra->hdr += 80; \ ++ yyextra->nkeyrec--; \ + count = 81; \ + } else { \ + count = YY_NULL; \ } \ } -/* These global variables are required by YY_INPUT. */ -+// These global variables are required by YY_INPUT. - const char *fitshdr_hdr; - int fitshdr_nkeyrec; - +-const char *fitshdr_hdr; +-int fitshdr_nkeyrec; +- -/* Used in preempting the call to exit() by yy_fatal_error(). */ -+// Used in preempting the call to exit() by yy_fatal_error(). - jmp_buf fitshdr_abort_jmp_env; - #define exit(status) longjmp(fitshdr_abort_jmp_env, status) +-jmp_buf fitshdr_abort_jmp_env; +-#define exit(status) longjmp(fitshdr_abort_jmp_env, status) ++// Preempt the call to exit() by yy_fatal_error(). ++#define exit(status) longjmp(yyextra->abort_jmp_env, status); -/* Map status return value to message. */ ++// Internal helper functions. ++static YY_DECL; ++static void nullfill(char cptr[], int len); ++ +// Map status return value to message. const char *fitshdr_errmsg[] = { "Success", @@ -3956,126 +4613,188 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c -#line 10351 "fitshdr.c" -#line 10352 "fitshdr.c" -+#line 10348 "fitshdr.c" -+#line 10349 "fitshdr.c" ++#line 10327 "fitshdr.c" ++#line 10328 "fitshdr.c" #define INITIAL 0 #define VALUE 1 -@@ -10599,9 +10596,9 @@ YY_DECL +@@ -10366,9 +10342,7 @@ const char *fitshdr_errmsg[] = { + #include + #endif + +-#ifndef YY_EXTRA_TYPE +-#define YY_EXTRA_TYPE void * +-#endif ++#define YY_EXTRA_TYPE struct fitshdr_extra * + + /* Holds the entire state of the reentrant scanner. */ + struct yyguts_t +@@ -10599,52 +10573,67 @@ YY_DECL } { -#line 151 "fitshdr.l" -+#line 148 "fitshdr.l" ++#line 128 "fitshdr.l" -#line 153 "fitshdr.l" -+#line 150 "fitshdr.l" - char *cptr, ctmp[72]; - int blank, continuation, end, j, k, keyno; - double dtmp; -@@ -10619,13 +10616,13 @@ YY_DECL - return 1; +- char *cptr, ctmp[72]; +- int blank, continuation, end, j, k, keyno; +- double dtmp; +- struct fitskey *kptr; +- struct fitskeyid *iptr; +- void nullfill(char cptr[], int len); +- +- fitshdr_hdr = header; +- fitshdr_nkeyrec = nkeyrec; +- +- *nreject = 0; +- keyno = 0; ++#line 130 "fitshdr.l" ++ char ctmp[72]; + + if (keys == 0x0) { +- return 1; ++ return FITSHDRERR_NULL_POINTER; } - /* Allocate memory for the required number of fitskey structs. */ - /* Recall that calloc() initializes allocated memory to zero. */ + // Allocate memory for the required number of fitskey structs. + // Recall that calloc() initializes allocated memory to zero. ++ struct fitskey *kptr; if (!(kptr = *keys = calloc(nkeyrec, sizeof(struct fitskey)))) { - return 2; +- return 2; ++ return FITSHDRERR_MEMORY; } - /* Initialize keyids[]. */ +- iptr = keyids; +- for (j = 0; j < nkeyids; j++, iptr++) { ++ // Initialize returned values. ++ *nreject = 0; ++ + // Initialize keyids[]. - iptr = keyids; - for (j = 0; j < nkeyids; j++, iptr++) { ++ struct fitskeyid *iptr = keyids; ++ for (int j = 0; j < nkeyids; j++, iptr++) { iptr->count = 0; -@@ -10637,14 +10634,14 @@ YY_DECL - continuation = 0; - end = 0; + iptr->idx[0] = -1; + iptr->idx[1] = -1; + } ++ ++ int keyno = 0; ++ ++ int blank = 0; ++ int continuation = 0; ++ int end = 0; +- blank = 0; +- continuation = 0; +- end = 0; +- - /* Return here via longjmp() invoked by yy_fatal_error(). */ +- if (setjmp(fitshdr_abort_jmp_env)) { +- return 3; ++#ifdef WCSLIB_INT64 ++#define asString(S) stringize(S) ++#define stringize(S) #S ++ ++ const char *int64fmt; ++ if (strcmp(asString(WCSLIB_INT64), "long long int") == 0) { ++ int64fmt = "%lld"; ++ } else if (strcmp(asString(WCSLIB_INT64), "long int") == 0) { ++ int64fmt = "%ld"; ++ } else if (strcmp(asString(WCSLIB_INT64), "int") == 0) { ++ int64fmt = "%d"; ++ } else { ++ return FITSHDRERR_DATA_TYPE; ++ } ++#endif ++ ++ // User data associated with yyscanner. ++ yyextra->hdr = header; ++ yyextra->nkeyrec = nkeyrec; ++ + // Return here via longjmp() invoked by yy_fatal_error(). - if (setjmp(fitshdr_abort_jmp_env)) { - return 3; ++ if (setjmp(yyextra->abort_jmp_env)) { ++ return FITSHDRERR_FLEX_PARSER; } BEGIN(INITIAL); -#line 10648 "fitshdr.c" -+#line 10645 "fitshdr.c" ++#line 10637 "fitshdr.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { -@@ -10698,9 +10695,9 @@ do_action: /* This label is used only to +@@ -10698,9 +10687,9 @@ do_action: /* This label is used only to case 1: YY_RULE_SETUP -#line 195 "fitshdr.l" -+#line 192 "fitshdr.l" ++#line 187 "fitshdr.l" { - /* A completely blank keyrecord. */ + // A completely blank keyrecord. strncpy(kptr->keyword, yytext, 8); yyless(0); blank = 1; -@@ -10709,7 +10706,7 @@ YY_RULE_SETUP +@@ -10709,7 +10698,7 @@ YY_RULE_SETUP YY_BREAK case 2: YY_RULE_SETUP -#line 203 "fitshdr.l" -+#line 200 "fitshdr.l" ++#line 195 "fitshdr.l" { strncpy(kptr->keyword, yytext, 8); BEGIN(COMMENT); -@@ -10717,7 +10714,7 @@ YY_RULE_SETUP +@@ -10717,7 +10706,7 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 208 "fitshdr.l" -+#line 205 "fitshdr.l" ++#line 200 "fitshdr.l" { strncpy(kptr->keyword, yytext, 8); end = 1; -@@ -10726,9 +10723,9 @@ YY_RULE_SETUP +@@ -10726,9 +10715,9 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 214 "fitshdr.l" -+#line 211 "fitshdr.l" ++#line 206 "fitshdr.l" { - /* Illegal END keyrecord. */ + // Illegal END keyrecord. strncpy(kptr->keyword, yytext, 8); kptr->status |= FITSHDR_KEYREC; BEGIN(VALUE); -@@ -10736,9 +10733,9 @@ YY_RULE_SETUP +@@ -10736,9 +10725,9 @@ YY_RULE_SETUP YY_BREAK case 5: YY_RULE_SETUP -#line 221 "fitshdr.l" -+#line 218 "fitshdr.l" ++#line 213 "fitshdr.l" { - /* Illegal END keyrecord. */ + // Illegal END keyrecord. strncpy(kptr->keyword, yytext, 8); kptr->status |= FITSHDR_KEYREC; BEGIN(COMMENT); -@@ -10746,7 +10743,7 @@ YY_RULE_SETUP +@@ -10746,7 +10735,7 @@ YY_RULE_SETUP YY_BREAK case 6: YY_RULE_SETUP -#line 228 "fitshdr.l" -+#line 225 "fitshdr.l" ++#line 220 "fitshdr.l" { strncpy(kptr->keyword, yytext, 8); BEGIN(VALUE); -@@ -10755,20 +10752,20 @@ YY_RULE_SETUP +@@ -10755,20 +10744,21 @@ YY_RULE_SETUP case 7: /* rule 7 can match eol */ YY_RULE_SETUP -#line 233 "fitshdr.l" -+#line 230 "fitshdr.l" ++#line 225 "fitshdr.l" { - /* Continued string keyvalue. */ + // Continued string keyvalue. @@ -4084,6 +4803,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c if (keyno > 0 && (kptr-1)->type%10 == 8) { - /* Put back the string keyvalue. */ + // Put back the string keyvalue. ++ int k; for (k = 10; yytext[k] != '\''; k++); yyless(k); continuation = 1; @@ -4095,12 +4815,12 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c yyless(8); BEGIN(COMMENT); } -@@ -10776,18 +10773,18 @@ YY_RULE_SETUP +@@ -10776,18 +10766,18 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 251 "fitshdr.l" -+#line 248 "fitshdr.l" ++#line 244 "fitshdr.l" { - /* Keyword without value. */ + // Keyword without value. @@ -4111,31 +4831,31 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c case 9: YY_RULE_SETUP -#line 257 "fitshdr.l" -+#line 254 "fitshdr.l" ++#line 250 "fitshdr.l" { - /* Illegal keyword, carry on regardless. */ + // Illegal keyword, carry on regardless. strncpy(kptr->keyword, yytext, 8); kptr->status |= FITSHDR_KEYWORD; BEGIN(VALUE); -@@ -10795,9 +10792,9 @@ YY_RULE_SETUP +@@ -10795,9 +10785,9 @@ YY_RULE_SETUP YY_BREAK case 10: YY_RULE_SETUP -#line 264 "fitshdr.l" -+#line 261 "fitshdr.l" ++#line 257 "fitshdr.l" { - /* Illegal keyword, carry on regardless. */ + // Illegal keyword, carry on regardless. strncpy(kptr->keyword, yytext, 8); kptr->status |= FITSHDR_KEYWORD; BEGIN(COMMENT); -@@ -10808,17 +10805,17 @@ case 11: +@@ -10808,17 +10798,17 @@ case 11: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 271 "fitshdr.l" -+#line 268 "fitshdr.l" ++#line 264 "fitshdr.l" { - /* Null keyvalue. */ + // Null keyvalue. @@ -4145,34 +4865,35 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c case 12: YY_RULE_SETUP -#line 276 "fitshdr.l" -+#line 273 "fitshdr.l" ++#line 269 "fitshdr.l" { - /* Logical keyvalue. */ + // Logical keyvalue. kptr->type = 1; kptr->keyvalue.i = (*yytext == 'T'); BEGIN(INLINE); -@@ -10826,9 +10823,9 @@ YY_RULE_SETUP +@@ -10826,9 +10816,9 @@ YY_RULE_SETUP YY_BREAK case 13: YY_RULE_SETUP -#line 283 "fitshdr.l" -+#line 280 "fitshdr.l" ++#line 276 "fitshdr.l" { - /* 32-bit signed integer keyvalue. */ + // 32-bit signed integer keyvalue. kptr->type = 2; if (sscanf(yytext, "%d", &(kptr->keyvalue.i)) < 1) { kptr->status |= FITSHDR_KEYVALUE; -@@ -10840,15 +10837,15 @@ YY_RULE_SETUP +@@ -10840,15 +10830,16 @@ YY_RULE_SETUP YY_BREAK case 14: YY_RULE_SETUP -#line 294 "fitshdr.l" -+#line 291 "fitshdr.l" ++#line 287 "fitshdr.l" { - /* 64-bit signed integer keyvalue (up to 18 digits). */ + // 64-bit signed integer keyvalue (up to 18 digits). ++ double dtmp; if (wcsutil_str2double(yytext, &dtmp)) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); @@ -4183,7 +4904,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c kptr->type = 2; if (sscanf(yytext, "%d", &(kptr->keyvalue.i)) < 1) { kptr->status |= FITSHDR_KEYVALUE; -@@ -10856,16 +10853,16 @@ YY_RULE_SETUP +@@ -10856,16 +10847,16 @@ YY_RULE_SETUP } } else { @@ -4192,8 +4913,9 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c kptr->type = 3; #ifdef WCSLIB_INT64 - /* Native 64-bit integer is available. */ +- if (sscanf(yytext, "%lld", &(kptr->keyvalue.k)) < 1) { + // Native 64-bit integer is available. - if (sscanf(yytext, "%lld", &(kptr->keyvalue.k)) < 1) { ++ if (sscanf(yytext, int64fmt, &(kptr->keyvalue.k)) < 1) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } @@ -4203,25 +4925,26 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c kptr->keyvalue.k[2] = 0; sprintf(ctmp, "%%%dd%%9d", yyleng-9); -@@ -10884,14 +10881,14 @@ YY_RULE_SETUP +@@ -10884,14 +10875,14 @@ YY_RULE_SETUP YY_BREAK case 15: YY_RULE_SETUP -#line 335 "fitshdr.l" -+#line 332 "fitshdr.l" ++#line 329 "fitshdr.l" { - /* Very long integer keyvalue (and 19-digit int64). */ + // Very long integer keyvalue (and 19-digit int64). kptr->type = 4; strcpy(ctmp, yytext); - k = yyleng; +- k = yyleng; ++ int j, k = yyleng; for (j = 0; j < 8; j++) { - /* Read it backwards. */ + // Read it backwards. k -= 9; if (k < 0) k = 0; if (sscanf(ctmp+k, "%d", kptr->keyvalue.l+j) < 1) { -@@ -10906,7 +10903,7 @@ YY_RULE_SETUP +@@ -10906,7 +10897,7 @@ YY_RULE_SETUP ctmp[k] = '\0'; } @@ -4230,70 +4953,82 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c if (j == 2 && abs(kptr->keyvalue.l[2]) <= 9 && abs(kptr->keyvalue.l[1]) <= 223372036 && kptr->keyvalue.l[0] <= 854775807 && -@@ -10914,7 +10911,7 @@ YY_RULE_SETUP +@@ -10914,9 +10905,9 @@ YY_RULE_SETUP kptr->type = 3; #ifdef WCSLIB_INT64 - /* Native 64-bit integer is available. */ + // Native 64-bit integer is available. kptr->keyvalue.l[2] = 0; - if (sscanf(yytext, "%lld", &(kptr->keyvalue.k)) < 1) { +- if (sscanf(yytext, "%lld", &(kptr->keyvalue.k)) < 1) { ++ if (sscanf(yytext, int64fmt, &(kptr->keyvalue.k)) < 1) { kptr->status |= FITSHDR_KEYVALUE; -@@ -10928,9 +10925,9 @@ YY_RULE_SETUP + BEGIN(ERROR); + } +@@ -10928,9 +10919,9 @@ YY_RULE_SETUP YY_BREAK case 16: YY_RULE_SETUP -#line 376 "fitshdr.l" -+#line 373 "fitshdr.l" ++#line 370 "fitshdr.l" { - /* Float keyvalue. */ + // Float keyvalue. kptr->type = 5; if (wcsutil_str2double(yytext, &(kptr->keyvalue.f))) { kptr->status |= FITSHDR_KEYVALUE; -@@ -10942,9 +10939,9 @@ YY_RULE_SETUP +@@ -10942,9 +10933,9 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 387 "fitshdr.l" -+#line 384 "fitshdr.l" ++#line 381 "fitshdr.l" { - /* Integer complex keyvalue. */ + // Integer complex keyvalue. kptr->type = 6; if (sscanf(yytext, "(%lf,%lf)", kptr->keyvalue.c, kptr->keyvalue.c+1) < 2) { -@@ -10957,9 +10954,9 @@ YY_RULE_SETUP +@@ -10957,11 +10948,13 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 399 "fitshdr.l" -+#line 396 "fitshdr.l" ++#line 393 "fitshdr.l" { - /* Floating point complex keyvalue. */ + // Floating point complex keyvalue. kptr->type = 7; ++ char *cptr; ++ int k; for (cptr = ctmp, k = 1; yytext[k] != ','; cptr++, k++) { -@@ -10988,14 +10985,14 @@ YY_RULE_SETUP + *cptr = yytext[k]; + } +@@ -10988,16 +10981,16 @@ YY_RULE_SETUP case 19: /* rule 19 can match eol */ YY_RULE_SETUP -#line 426 "fitshdr.l" -+#line 423 "fitshdr.l" ++#line 422 "fitshdr.l" { - /* String keyvalue. */ + // String keyvalue. kptr->type = 8; - cptr = kptr->keyvalue.s; +- cptr = kptr->keyvalue.s; ++ char *cptr = kptr->keyvalue.s; strcpy(cptr, yytext+1); - /* Squeeze out repeated quotes. */ +- k = 0; +- for (j = 0; j < 72; j++) { + // Squeeze out repeated quotes. - k = 0; - for (j = 0; j < 72; j++) { ++ int k = 0; ++ for (int j = 0; j < 72; j++) { if (k < j) { -@@ -11013,7 +11010,7 @@ YY_RULE_SETUP + cptr[k] = cptr[j]; + } +@@ -11013,7 +11006,7 @@ YY_RULE_SETUP } if (*cptr) { @@ -4302,30 +5037,30 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c nullfill(cptr+1, 71); } else { nullfill(cptr, 72); -@@ -11024,7 +11021,7 @@ YY_RULE_SETUP +@@ -11024,7 +11017,7 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 459 "fitshdr.l" -+#line 456 "fitshdr.l" ++#line 455 "fitshdr.l" { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); -@@ -11035,7 +11032,7 @@ case 21: +@@ -11035,7 +11028,7 @@ case 21: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 464 "fitshdr.l" -+#line 461 "fitshdr.l" ++#line 460 "fitshdr.l" { BEGIN(FLUSH); } -@@ -11045,21 +11042,21 @@ case 22: +@@ -11045,21 +11038,21 @@ case 22: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 468 "fitshdr.l" -+#line 465 "fitshdr.l" ++#line 464 "fitshdr.l" { BEGIN(FLUSH); } @@ -4333,7 +5068,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c case 23: YY_RULE_SETUP -#line 472 "fitshdr.l" -+#line 469 "fitshdr.l" ++#line 468 "fitshdr.l" { BEGIN(UNITS); } @@ -4341,64 +5076,69 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c case 24: YY_RULE_SETUP -#line 476 "fitshdr.l" -+#line 473 "fitshdr.l" ++#line 472 "fitshdr.l" { kptr->status |= FITSHDR_COMMENT; BEGIN(ERROR); -@@ -11067,9 +11064,9 @@ YY_RULE_SETUP +@@ -11067,9 +11060,9 @@ YY_RULE_SETUP YY_BREAK case 25: YY_RULE_SETUP -#line 481 "fitshdr.l" -+#line 478 "fitshdr.l" ++#line 477 "fitshdr.l" { - /* Keyvalue parsing must now also be suspect. */ + // Keyvalue parsing must now also be suspect. kptr->status |= FITSHDR_COMMENT; kptr->type = 0; BEGIN(ERROR); -@@ -11077,7 +11074,7 @@ YY_RULE_SETUP +@@ -11077,7 +11070,7 @@ YY_RULE_SETUP YY_BREAK case 26: YY_RULE_SETUP -#line 488 "fitshdr.l" -+#line 485 "fitshdr.l" ++#line 484 "fitshdr.l" { kptr->ulen = yyleng; yymore(); -@@ -11086,7 +11083,7 @@ YY_RULE_SETUP +@@ -11086,7 +11079,7 @@ YY_RULE_SETUP YY_BREAK case 27: YY_RULE_SETUP -#line 494 "fitshdr.l" -+#line 491 "fitshdr.l" ++#line 490 "fitshdr.l" { yymore(); BEGIN(COMMENT); -@@ -11094,7 +11091,7 @@ YY_RULE_SETUP +@@ -11094,7 +11087,7 @@ YY_RULE_SETUP YY_BREAK case 28: YY_RULE_SETUP -#line 499 "fitshdr.l" -+#line 496 "fitshdr.l" ++#line 495 "fitshdr.l" { strcpy(kptr->comment, yytext); nullfill(kptr->comment, 84); -@@ -11103,7 +11100,7 @@ YY_RULE_SETUP +@@ -11103,11 +11096,11 @@ YY_RULE_SETUP YY_BREAK case 29: YY_RULE_SETUP -#line 505 "fitshdr.l" -+#line 502 "fitshdr.l" ++#line 501 "fitshdr.l" { if (!continuation) kptr->type = -abs(kptr->type); -@@ -11117,16 +11114,16 @@ YY_RULE_SETUP +- sprintf(kptr->comment, "%.80s", fitshdr_hdr-80); ++ sprintf(kptr->comment, "%.80s", yyextra->hdr-80); + kptr->comment[80] = '\0'; + nullfill(kptr->comment+80, 4); + +@@ -11117,20 +11110,21 @@ YY_RULE_SETUP case 30: /* rule 30 can match eol */ YY_RULE_SETUP -#line 515 "fitshdr.l" -+#line 512 "fitshdr.l" ++#line 511 "fitshdr.l" { - /* Discard the rest of the input line. */ + // Discard the rest of the input line. @@ -4413,8 +5153,15 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c + // Do indexing. iptr = keyids; kptr->keyid = -1; - for (j = 0; j < nkeyids; j++, iptr++) { -@@ -11138,7 +11135,7 @@ YY_RULE_SETUP +- for (j = 0; j < nkeyids; j++, iptr++) { +- cptr = iptr->name; ++ for (int j = 0; j < nkeyids; j++, iptr++) { ++ int k; ++ char *cptr = iptr->name; + cptr[8] = '\0'; + nullfill(cptr, 12); + for (k = 0; k < 8; k++, cptr++) { +@@ -11138,7 +11132,7 @@ YY_RULE_SETUP } if (k == 8) { @@ -4423,7 +5170,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c iptr->count++; if (iptr->idx[0] == -1) { iptr->idx[0] = keyno-1; -@@ -11151,9 +11148,9 @@ YY_RULE_SETUP +@@ -11151,17 +11145,17 @@ YY_RULE_SETUP } } @@ -4433,9 +5180,10 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c - /* Tidy up the previous string keyvalue. */ + // Tidy up the previous string keyvalue. if ((kptr-1)->type == 8) (kptr-1)->type += 10; - cptr = (kptr-1)->keyvalue.s; +- cptr = (kptr-1)->keyvalue.s; ++ char *cptr = (kptr-1)->keyvalue.s; if (cptr[strlen(cptr)-1] == '&') cptr[strlen(cptr)-1] = '\0'; -@@ -11161,7 +11158,7 @@ YY_RULE_SETUP + kptr->type = (kptr-1)->type + 10; } @@ -4444,7 +5192,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c if (end && (end++ > 1) && !blank) { kptr->status |= FITSHDR_TRAILER; } -@@ -11181,18 +11178,18 @@ case YY_STATE_EOF(UNITS): +@@ -11181,18 +11175,18 @@ case YY_STATE_EOF(UNITS): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(ERROR): case YY_STATE_EOF(FLUSH): @@ -4463,11 +5211,11 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c ECHO; YY_BREAK -#line 11196 "fitshdr.c" -+#line 11193 "fitshdr.c" ++#line 11190 "fitshdr.c" case YY_END_OF_BUFFER: { -@@ -12319,17 +12316,17 @@ void yyfree (void * ptr , yyscan_t yysca +@@ -12319,27 +12313,56 @@ void yyfree (void * ptr , yyscan_t yysca #define YYTABLES_NAME "yytables" @@ -4476,22 +5224,65 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/fitshdr.c -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- ++/*---------------------------------------------------------------------------- ++* External interface to the scanner. ++*---------------------------------------------------------------------------*/ - void nullfill(char cptr[], int len) +-void nullfill(char cptr[], int len) ++int fitshdr( ++ const char header[], ++ int nkeyrec, ++ int nkeyids, ++ struct fitskeyid keyids[], ++ int *nreject, ++ struct fitskey **keys) { - int j, k; +- int j, k; ++ // Function prototypes. ++ int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner); ++ int yylex_destroy(yyscan_t yyscanner); - /* Null-fill the string. */ -+ // Null-fill the string. ++ struct fitshdr_extra extra; ++ yyscan_t yyscanner; ++ yylex_init_extra(&extra, &yyscanner); ++ int status = fitshdr_scanner(header, nkeyrec, nkeyids, keyids, nreject, ++ keys, yyscanner); ++ yylex_destroy(yyscanner); ++ ++ return status; ++} ++ ++/*---------------------------------------------------------------------------- ++* Pad a string with null characters. ++*---------------------------------------------------------------------------*/ ++ ++void nullfill(char cptr[], int len) ++ ++{ ++ // Propagate the terminating null to the end of the string. ++ int j; for (j = 0; j < len; j++) { if (cptr[j] == '\0') { - for (k = j+1; k < len; k++) { -Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c +- for (k = j+1; k < len; k++) { ++ for (int k = j+1; k < len; k++) { + cptr[k] = '\0'; + } + break; + } + } + +- for (k = j-1; k >= 0; k--) { ++ // Remove trailing blanks. ++ for (int k = j-1; k >= 0; k--) { + if (cptr[k] != ' ') break; + cptr[k] = '\0'; + } +Index: astropy-4.2.1/cextern/wcslib/C/flexed/wcsbth.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/flexed/wcsbth.c -+++ astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c +--- astropy-4.2.1.orig/cextern/wcslib/C/flexed/wcsbth.c ++++ astropy-4.2.1/cextern/wcslib/C/flexed/wcsbth.c @@ -25388,9 +25388,8 @@ static const yy_state_type yy_NUL_trans[ #define YY_RESTORE_YY_MORE_OFFSET #line 1 "wcsbth.l" @@ -4499,7 +5290,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -4513,7 +5304,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsbth.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcsbth.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcsbth.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * * wcsbth.l is a Flex description file containing the definition of a lexical @@ -4522,11 +5313,11 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c -#line 115 "wcsbth.l" -+#line 112 "wcsbth.l" ++#line 113 "wcsbth.l" #include #include #include -@@ -25487,30 +25484,30 @@ static const yy_state_type yy_NUL_trans[ +@@ -25487,57 +25484,34 @@ static const yy_state_type yy_NUL_trans[ #include "wcsprintf.h" #include "wcsutil.h" @@ -4549,6 +5340,10 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c -#define BINTAB 0xC /* BIMGARR | PIXLIST, i.e. binary table */ - /* image array (without axis number) or */ - /* pixel list, e.g. LONPna or OBSGXn. */ +- +-static int wcsbth_scanner(char *header, int nkeyrec, int relax, int ctrl, +- int keysel, int *colsel, int *nreject, int *nwcs, +- struct wcsprm **wcs, yyscan_t yyscanner); + // Bit masks used for keyword types: +#define IMGAUX 0x1 // Auxiliary image header, e.g. LONPOLEa or + // DATE-OBS. @@ -4561,58 +5356,99 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c +#define BINTAB 0xC // BIMGARR | PIXLIST, i.e. binary table + // image array (without axis number) or + // pixel list, e.g. LONPna or OBSGXn. - - static int wcsbth_scanner(char *header, int nkeyrec, int relax, int ctrl, - int keysel, int *colsel, int *nreject, int *nwcs, - struct wcsprm **wcs, yyscan_t yyscanner); ++ ++// User data associated with yyscanner. ++struct wcsbth_extra { ++ // Values passed to YY_INPUT. ++ char *hdr; ++ int nkeyrec; -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- - - int wcsbth( - char *header, -@@ -25537,7 +25534,7 @@ int wcsbth( - return status; - } - +- +-int wcsbth( +- char *header, +- int nkeyrec, +- int relax, +- int ctrl, +- int keysel, +- int *colsel, +- int *nreject, +- int *nwcs, +- struct wcsprm **wcs) +- +-{ +- int status; +- yyscan_t yyscanner; +- int yylex_init(yyscan_t *yyscanner); +- int yylex_destroy(yyscan_t yyscanner); +- +- yylex_init(&yyscanner); +- status = wcsbth_scanner(header, nkeyrec, relax, ctrl, keysel, colsel, +- nreject, nwcs, wcs, yyscanner); +- yylex_destroy(yyscanner); +- +- return status; +-} +- -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- ++ // Used in preempting the call to exit() by yy_fatal_error(). ++ jmp_buf abort_jmp_env; ++}; #define YY_DECL int wcsbth_scanner(char *header, int nkeyrec, int relax, \ int ctrl, int keysel, int *colsel, int *nreject, int *nwcs, \ -@@ -25556,18 +25553,18 @@ int wcsbth( +@@ -25545,29 +25519,28 @@ int wcsbth( + + #define YY_INPUT(inbuff, count, bufsize) \ + { \ +- if (wcsbth_nkeyrec) { \ +- strncpy(inbuff, wcsbth_hdr, 80); \ ++ if (yyextra->nkeyrec) { \ ++ strncpy(inbuff, yyextra->hdr, 80); \ + inbuff[80] = '\n'; \ +- wcsbth_hdr += 80; \ +- wcsbth_nkeyrec--; \ ++ yyextra->hdr += 80; \ ++ yyextra->nkeyrec--; \ + count = 81; \ + } else { \ + count = YY_NULL; \ } \ } -/* A convenience macro to get around incompatibilities between unput() and - yyless(): put yytext followed by a blank back onto the input stream. */ ++// Preempt the call to exit() by yy_fatal_error(). ++#define exit(status) longjmp(yyextra->abort_jmp_env, status); ++ +// A convenience macro to get around incompatibilities between unput() and +// yyless(): put yytext followed by a blank back onto the input stream. #define WCSBTH_PUTBACK \ sprintf(strtmp, "%s ", yytext); \ - iz = strlen(strtmp); \ +- iz = strlen(strtmp); \ ++ size_t iz = strlen(strtmp); \ while (iz) unput(strtmp[--iz]); -/* These global variables are required by YY_INPUT. */ -+// These global variables are required by YY_INPUT. - static char *wcsbth_hdr; - static int wcsbth_nkeyrec; - +-static char *wcsbth_hdr; +-static int wcsbth_nkeyrec; +- -/* Struct used internally for header bookkeeping. */ +// Struct used internally for header bookkeeping. struct wcsbth_alts { int ncol, ialt, icol, imgherit; short int (*arridx)[27]; -@@ -25582,7 +25579,7 @@ struct wcsbth_alts { +@@ -25582,7 +25555,8 @@ struct wcsbth_alts { unsigned char pad2[2]; }; -/* Internal helper functions. */ +// Internal helper functions. ++static YY_DECL; static int wcsbth_colax(struct wcsprm *wcs, struct wcsbth_alts *alts, int k, char a); static int wcsbth_final(struct wcsbth_alts *alts, int *nwcs, -@@ -25594,22 +25591,22 @@ static int wcsbth_init1(struct wcsbth_al +@@ -25594,22 +25568,18 @@ static int wcsbth_init1(struct wcsbth_al static int wcsbth_pass1(int keytype, int i, int j, int n, int k, char a, char ptype, struct wcsbth_alts *alts); @@ -4629,148 +5465,230 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c static int wcsbth_timepixr(double timepixr); -/* Used in preempting the call to exit() by yy_fatal_error(). */ -+// Used in preempting the call to exit() by yy_fatal_error(). - jmp_buf wcsbth_abort_jmp_env; - #define exit(status) longjmp(wcsbth_abort_jmp_env, status) - +-jmp_buf wcsbth_abort_jmp_env; +-#define exit(status) longjmp(wcsbth_abort_jmp_env, status) +- -#line 25612 "wcsbth.c" -#line 25613 "wcsbth.c" -+#line 25609 "wcsbth.c" -+#line 25610 "wcsbth.c" ++#line 25582 "wcsbth.c" ++#line 25583 "wcsbth.c" #define INITIAL 0 #define CCCCCia 1 -@@ -25889,10 +25886,10 @@ YY_DECL +@@ -25654,9 +25624,7 @@ jmp_buf wcsbth_abort_jmp_env; + #include + #endif + +-#ifndef YY_EXTRA_TYPE +-#define YY_EXTRA_TYPE void * +-#endif ++#define YY_EXTRA_TYPE struct wcsbth_extra * + + /* Holds the entire state of the reentrant scanner. */ + struct yyguts_t +@@ -25889,102 +25857,89 @@ YY_DECL } { -#line 251 "wcsbth.l" -+#line 248 "wcsbth.l" ++#line 222 "wcsbth.l" -#line 253 "wcsbth.l" - /* Keyword indices, as used in the WCS papers, e.g. iVn_ma, TPn_ka. */ -+#line 250 "wcsbth.l" -+ // Keyword indices, as used in the WCS papers, e.g. iVn_ma, TPn_ka. - char a; - int i, j, k, m, n; - -@@ -25911,37 +25908,37 @@ YY_DECL - int (*chekval)(double); - int (*special)(double *, const double *); +- char a; +- int i, j, k, m, n; +- +- char *cptr, *errmsg, errtxt[80], exclude[1000], gotone, *hptr, *keep, +- *keyname, *keyrec, ptype, strtmp[80]; +- int altlin, auxprm, ialt, icol, incl, imherit, inttmp, ipass, ipx, +- itmp, ix, jx, keytype, naux, nother, nsel, npass, nvalid, status, +- valtype; +- ptrdiff_t voff; +- size_t iz; ++#line 224 "wcsbth.l" ++ char *errmsg, errtxt[80], *keyname, strtmp[80]; ++ int auxprm, inttmp; + double dbltmp, dbl2tmp[2]; +- void *vptr, *wptr; +- struct wcsbth_alts alts; +- struct auxprm *auxp, auxtem; +- struct wcsprm *wcsp, wcstem; +- int (*chekval)(double); +- int (*special)(double *, const double *); ++ struct auxprm auxtem; ++ struct wcsprm wcstem; - /* The data structures produced. */ -+ // The data structures produced. ++ // Initialize returned values. ++ *nreject = 0; *nwcs = 0; *wcs = 0x0; - /* Parameters used to implement YY_INPUT. */ -+ // Parameters used to implement YY_INPUT. - wcsbth_hdr = header; - wcsbth_nkeyrec = nkeyrec; - +- wcsbth_hdr = header; +- wcsbth_nkeyrec = nkeyrec; +- - /* Our handle on the input stream. */ -+ // Our handle on the input stream. - keyrec = header; - hptr = header; - keep = 0x0; - +- keyrec = header; +- hptr = header; +- keep = 0x0; +- - /* For keeping tallies of keywords found. */ +- *nreject = 0; +- nvalid = 0; +- nother = 0; ++ // Our handle on the input stream. ++ char *keyrec = header; ++ char *hptr = header; ++ char *keep = 0x0; ++ + // For keeping tallies of keywords found. - *nreject = 0; - nvalid = 0; - nother = 0; ++ int nvalid = 0; ++ int nother = 0; - /* Used to flag image header keywords that are always inherited. */ +- imherit = 1; + // Used to flag image header keywords that are always inherited. - imherit = 1; ++ int imherit = 1; - /* If strict, then also reject. */ + // If strict, then also reject. if (relax & WCSHDR_strict) relax |= WCSHDR_reject; - /* Keyword parameters. */ -+ // Keyword parameters. - i = j = 0; - n = k = 0; - m = 0; - a = ' '; +- i = j = 0; +- n = k = 0; +- m = 0; +- a = ' '; ++ // Keyword indices, as used in the WCS papers, e.g. iVn_ma, TPn_ka. ++ int i = 0; ++ int j = 0; ++ int k = 0; ++ int n = 0; ++ int m = 0; ++ char a = ' '; - /* Header bookkeeping. */ + // Header bookkeeping. ++ struct wcsbth_alts alts; alts.ncol = 0; alts.arridx = 0x0; alts.pixlist = 0x0; -@@ -25954,12 +25951,12 @@ YY_DECL + alts.npv = 0x0; + alts.nps = 0x0; + +- for (ialt = 0; ialt < 27; ialt++) { ++ for (int ialt = 0; ialt < 27; ialt++) { + alts.pixidx[ialt] = 0; + alts.pixnpv[ialt] = 0; alts.pixnps[ialt] = 0; } - /* For decoding the keyvalue. */ -+ // For decoding the keyvalue. - keytype = 0; - valtype = -1; - vptr = 0x0; - +- keytype = 0; +- valtype = -1; +- vptr = 0x0; +- - /* For keywords that require special handling. */ -+ // For keywords that require special handling. - altlin = 0; - ptype = ' '; - chekval = 0x0; -@@ -25967,7 +25964,7 @@ YY_DECL - auxprm = 0; - naux = 0; - +- altlin = 0; +- ptype = ' '; +- chekval = 0x0; +- special = 0x0; +- auxprm = 0; +- naux = 0; +- - /* Selection by column number. */ +- nsel = colsel ? colsel[0] : 0; +- incl = (nsel > 0); +- for (icol = 0; icol < 1000; icol++) { ++ // For decoding the keyvalue. ++ int keytype = 0; ++ int valtype = -1; ++ void *vptr = 0x0; ++ ++ // For keywords that require special handling. ++ int altlin = 0; ++ char ptype = ' '; ++ int (*chekval)(double) = 0x0; ++ int (*special)(double *, const double *) = 0x0; ++ struct auxprm *auxp = 0x0; ++ int naux = 0; ++ + // Selection by column number. - nsel = colsel ? colsel[0] : 0; - incl = (nsel > 0); - for (icol = 0; icol < 1000; icol++) { -@@ -25981,7 +25978,7 @@ YY_DECL ++ int nsel = colsel ? colsel[0] : 0; ++ int incl = (nsel > 0); ++ char exclude[1000]; ++ for (int icol = 0; icol < 1000; icol++) { + exclude[icol] = incl; + } +- for (icol = 1; icol <= abs(nsel); icol++) { +- itmp = colsel[icol]; ++ for (int icol = 1; icol <= abs(nsel); icol++) { ++ int itmp = colsel[icol]; + if (0 < itmp && itmp < 1000) { + exclude[itmp] = !incl; + } } exclude[0] = 0; - /* Selection by keyword type. */ +- itmp = keysel; +- keysel = 0; +- if (itmp) { + // Selection by keyword type. - itmp = keysel; - keysel = 0; - if (itmp) { -@@ -25993,11 +25990,11 @@ YY_DECL ++ if (keysel) { ++ int itmp = keysel; ++ keysel = 0; + if (itmp & WCSHDR_IMGHEAD) keysel |= IMGHEAD; + if (itmp & WCSHDR_BIMGARR) keysel |= BIMGARR; + if (itmp & WCSHDR_PIXLIST) keysel |= PIXLIST; +@@ -25993,19 +25948,23 @@ YY_DECL keysel = IMGHEAD | BINTAB; } - /* Control variables. */ -+ // Control variables. - ipass = 1; - npass = 2; - +- ipass = 1; +- npass = 2; +- - /* Return here via longjmp() invoked by yy_fatal_error(). */ +- if (setjmp(wcsbth_abort_jmp_env)) { +- return 4; ++ // Control variables. ++ int ipass = 1; ++ int npass = 2; ++ ++ // User data associated with yyscanner. ++ yyextra->hdr = header; ++ yyextra->nkeyrec = nkeyrec; ++ + // Return here via longjmp() invoked by yy_fatal_error(). - if (setjmp(wcsbth_abort_jmp_env)) { - return 4; ++ if (setjmp(yyextra->abort_jmp_env)) { ++ return WCSHDRERR_PARSER; } -@@ -26005,7 +26002,7 @@ YY_DECL + BEGIN(INITIAL); -#line 26009 "wcsbth.c" -+#line 26006 "wcsbth.c" ++#line 25968 "wcsbth.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { -@@ -26053,7 +26050,7 @@ do_action: /* This label is used only to +@@ -26053,7 +26012,7 @@ do_action: /* This label is used only to case 1: YY_RULE_SETUP -#line 366 "wcsbth.l" -+#line 363 "wcsbth.l" ++#line 328 "wcsbth.l" { if (ipass == 1) { if (alts.ncol == 0) { -@@ -26071,10 +26068,10 @@ YY_RULE_SETUP +@@ -26071,10 +26030,10 @@ YY_RULE_SETUP YY_BREAK case 2: YY_RULE_SETUP -#line 381 "wcsbth.l" -+#line 378 "wcsbth.l" ++#line 343 "wcsbth.l" { if (!(keysel & IMGAXIS)) { - /* Ignore this key type. */ @@ -4778,7 +5696,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c BEGIN(DISCARD); } else { -@@ -26099,28 +26096,28 @@ YY_RULE_SETUP +@@ -26099,28 +26058,28 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -4791,14 +5709,14 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 3: -#line 415 "wcsbth.l" -+#line 412 "wcsbth.l" ++#line 377 "wcsbth.l" case 4: -#line 416 "wcsbth.l" -+#line 413 "wcsbth.l" ++#line 378 "wcsbth.l" case 5: YY_RULE_SETUP -#line 416 "wcsbth.l" -+#line 413 "wcsbth.l" ++#line 378 "wcsbth.l" { keyname = "WCAXna"; @@ -4814,735 +5732,735 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c BEGIN(DISCARD); } else if (i < 0) { -@@ -26139,16 +26136,16 @@ YY_RULE_SETUP +@@ -26139,16 +26098,16 @@ YY_RULE_SETUP YY_BREAK case 6: /* rule 6 can match eol */ -#line 442 "wcsbth.l" -+#line 439 "wcsbth.l" ++#line 404 "wcsbth.l" case 7: /* rule 7 can match eol */ -#line 443 "wcsbth.l" -+#line 440 "wcsbth.l" ++#line 405 "wcsbth.l" case 8: /* rule 8 can match eol */ YY_RULE_SETUP -#line 443 "wcsbth.l" -+#line 440 "wcsbth.l" ++#line 405 "wcsbth.l" { - /* Cross-reference supplier. */ + // Cross-reference supplier. keyname = "WCSTna"; errmsg = "cross-references are not implemented"; BEGIN(ERROR); -@@ -26156,16 +26153,16 @@ YY_RULE_SETUP +@@ -26156,16 +26115,16 @@ YY_RULE_SETUP YY_BREAK case 9: /* rule 9 can match eol */ -#line 451 "wcsbth.l" -+#line 448 "wcsbth.l" ++#line 413 "wcsbth.l" case 10: /* rule 10 can match eol */ -#line 452 "wcsbth.l" -+#line 449 "wcsbth.l" ++#line 414 "wcsbth.l" case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 452 "wcsbth.l" -+#line 449 "wcsbth.l" ++#line 414 "wcsbth.l" { - /* Cross-reference consumer. */ + // Cross-reference consumer. keyname = "WCSXna"; errmsg = "cross-references are not implemented"; BEGIN(ERROR); -@@ -26173,7 +26170,7 @@ YY_RULE_SETUP +@@ -26173,7 +26132,7 @@ YY_RULE_SETUP YY_BREAK case 12: YY_RULE_SETUP -#line 459 "wcsbth.l" -+#line 456 "wcsbth.l" ++#line 421 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crpix); -@@ -26183,10 +26180,10 @@ YY_RULE_SETUP +@@ -26183,10 +26142,10 @@ YY_RULE_SETUP } YY_BREAK case 13: -#line 468 "wcsbth.l" -+#line 465 "wcsbth.l" ++#line 430 "wcsbth.l" case 14: YY_RULE_SETUP -#line 468 "wcsbth.l" -+#line 465 "wcsbth.l" ++#line 430 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crpix); -@@ -26203,10 +26200,10 @@ YY_RULE_SETUP +@@ -26203,10 +26162,10 @@ YY_RULE_SETUP } YY_BREAK case 15: -#line 484 "wcsbth.l" -+#line 481 "wcsbth.l" ++#line 446 "wcsbth.l" case 16: YY_RULE_SETUP -#line 484 "wcsbth.l" -+#line 481 "wcsbth.l" ++#line 446 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crpix); -@@ -26222,7 +26219,7 @@ YY_RULE_SETUP +@@ -26222,7 +26181,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 497 "wcsbth.l" -+#line 494 "wcsbth.l" ++#line 459 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.pc); -@@ -26234,7 +26231,7 @@ YY_RULE_SETUP +@@ -26234,7 +26193,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 506 "wcsbth.l" -+#line 503 "wcsbth.l" ++#line 468 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.pc); -@@ -26247,10 +26244,10 @@ YY_RULE_SETUP +@@ -26247,10 +26206,10 @@ YY_RULE_SETUP } YY_BREAK case 19: -#line 518 "wcsbth.l" -+#line 515 "wcsbth.l" ++#line 480 "wcsbth.l" case 20: YY_RULE_SETUP -#line 518 "wcsbth.l" -+#line 515 "wcsbth.l" ++#line 480 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.pc); -@@ -26267,7 +26264,7 @@ YY_RULE_SETUP +@@ -26267,7 +26226,7 @@ YY_RULE_SETUP YY_BREAK case 21: YY_RULE_SETUP -#line 532 "wcsbth.l" -+#line 529 "wcsbth.l" ++#line 494 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.cd); -@@ -26279,7 +26276,7 @@ YY_RULE_SETUP +@@ -26279,7 +26238,7 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 541 "wcsbth.l" -+#line 538 "wcsbth.l" ++#line 503 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.cd); -@@ -26292,10 +26289,10 @@ YY_RULE_SETUP +@@ -26292,10 +26251,10 @@ YY_RULE_SETUP } YY_BREAK case 23: -#line 553 "wcsbth.l" -+#line 550 "wcsbth.l" ++#line 515 "wcsbth.l" case 24: YY_RULE_SETUP -#line 553 "wcsbth.l" -+#line 550 "wcsbth.l" ++#line 515 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.cd); -@@ -26312,7 +26309,7 @@ YY_RULE_SETUP +@@ -26312,7 +26271,7 @@ YY_RULE_SETUP YY_BREAK case 25: YY_RULE_SETUP -#line 567 "wcsbth.l" -+#line 564 "wcsbth.l" ++#line 529 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.cdelt); -@@ -26322,10 +26319,10 @@ YY_RULE_SETUP +@@ -26322,10 +26281,10 @@ YY_RULE_SETUP } YY_BREAK case 26: -#line 576 "wcsbth.l" -+#line 573 "wcsbth.l" ++#line 538 "wcsbth.l" case 27: YY_RULE_SETUP -#line 576 "wcsbth.l" -+#line 573 "wcsbth.l" ++#line 538 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.cdelt); -@@ -26342,10 +26339,10 @@ YY_RULE_SETUP +@@ -26342,10 +26301,10 @@ YY_RULE_SETUP } YY_BREAK case 28: -#line 592 "wcsbth.l" -+#line 589 "wcsbth.l" ++#line 554 "wcsbth.l" case 29: YY_RULE_SETUP -#line 592 "wcsbth.l" -+#line 589 "wcsbth.l" ++#line 554 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.cdelt); -@@ -26361,7 +26358,7 @@ YY_RULE_SETUP +@@ -26361,7 +26320,7 @@ YY_RULE_SETUP YY_BREAK case 30: YY_RULE_SETUP -#line 605 "wcsbth.l" -+#line 602 "wcsbth.l" ++#line 567 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crota); -@@ -26373,7 +26370,7 @@ YY_RULE_SETUP +@@ -26373,7 +26332,7 @@ YY_RULE_SETUP YY_BREAK case 31: YY_RULE_SETUP -#line 614 "wcsbth.l" -+#line 611 "wcsbth.l" ++#line 576 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crota); -@@ -26387,7 +26384,7 @@ YY_RULE_SETUP +@@ -26387,7 +26346,7 @@ YY_RULE_SETUP YY_BREAK case 32: YY_RULE_SETUP -#line 625 "wcsbth.l" -+#line 622 "wcsbth.l" ++#line 587 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crota); -@@ -26399,7 +26396,7 @@ YY_RULE_SETUP +@@ -26399,7 +26358,7 @@ YY_RULE_SETUP YY_BREAK case 33: YY_RULE_SETUP -#line 634 "wcsbth.l" -+#line 631 "wcsbth.l" ++#line 596 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.cunit); -@@ -26409,10 +26406,10 @@ YY_RULE_SETUP +@@ -26409,10 +26368,10 @@ YY_RULE_SETUP } YY_BREAK case 34: -#line 643 "wcsbth.l" -+#line 640 "wcsbth.l" ++#line 605 "wcsbth.l" case 35: YY_RULE_SETUP -#line 643 "wcsbth.l" -+#line 640 "wcsbth.l" ++#line 605 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.cunit); -@@ -26429,10 +26426,10 @@ YY_RULE_SETUP +@@ -26429,10 +26388,10 @@ YY_RULE_SETUP } YY_BREAK case 36: -#line 659 "wcsbth.l" -+#line 656 "wcsbth.l" ++#line 621 "wcsbth.l" case 37: YY_RULE_SETUP -#line 659 "wcsbth.l" -+#line 656 "wcsbth.l" ++#line 621 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.cunit); -@@ -26448,7 +26445,7 @@ YY_RULE_SETUP +@@ -26448,7 +26407,7 @@ YY_RULE_SETUP YY_BREAK case 38: YY_RULE_SETUP -#line 672 "wcsbth.l" -+#line 669 "wcsbth.l" ++#line 634 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.ctype); -@@ -26458,10 +26455,10 @@ YY_RULE_SETUP +@@ -26458,10 +26417,10 @@ YY_RULE_SETUP } YY_BREAK case 39: -#line 681 "wcsbth.l" -+#line 678 "wcsbth.l" ++#line 643 "wcsbth.l" case 40: YY_RULE_SETUP -#line 681 "wcsbth.l" -+#line 678 "wcsbth.l" ++#line 643 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.ctype); -@@ -26478,10 +26475,10 @@ YY_RULE_SETUP +@@ -26478,10 +26437,10 @@ YY_RULE_SETUP } YY_BREAK case 41: -#line 697 "wcsbth.l" -+#line 694 "wcsbth.l" ++#line 659 "wcsbth.l" case 42: YY_RULE_SETUP -#line 697 "wcsbth.l" -+#line 694 "wcsbth.l" ++#line 659 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.ctype); -@@ -26497,7 +26494,7 @@ YY_RULE_SETUP +@@ -26497,7 +26456,7 @@ YY_RULE_SETUP YY_BREAK case 43: YY_RULE_SETUP -#line 710 "wcsbth.l" -+#line 707 "wcsbth.l" ++#line 672 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crval); -@@ -26507,10 +26504,10 @@ YY_RULE_SETUP +@@ -26507,10 +26466,10 @@ YY_RULE_SETUP } YY_BREAK case 44: -#line 719 "wcsbth.l" -+#line 716 "wcsbth.l" ++#line 681 "wcsbth.l" case 45: YY_RULE_SETUP -#line 719 "wcsbth.l" -+#line 716 "wcsbth.l" ++#line 681 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crval); -@@ -26527,10 +26524,10 @@ YY_RULE_SETUP +@@ -26527,10 +26486,10 @@ YY_RULE_SETUP } YY_BREAK case 46: -#line 735 "wcsbth.l" -+#line 732 "wcsbth.l" ++#line 697 "wcsbth.l" case 47: YY_RULE_SETUP -#line 735 "wcsbth.l" -+#line 732 "wcsbth.l" ++#line 697 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crval); -@@ -26545,10 +26542,10 @@ YY_RULE_SETUP +@@ -26545,10 +26504,10 @@ YY_RULE_SETUP } YY_BREAK case 48: -#line 749 "wcsbth.l" -+#line 746 "wcsbth.l" ++#line 711 "wcsbth.l" case 49: YY_RULE_SETUP -#line 749 "wcsbth.l" -+#line 746 "wcsbth.l" ++#line 711 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.lonpole); -@@ -26564,10 +26561,10 @@ YY_RULE_SETUP +@@ -26564,10 +26523,10 @@ YY_RULE_SETUP } YY_BREAK case 50: -#line 764 "wcsbth.l" -+#line 761 "wcsbth.l" ++#line 726 "wcsbth.l" case 51: YY_RULE_SETUP -#line 764 "wcsbth.l" -+#line 761 "wcsbth.l" ++#line 726 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.latpole); -@@ -26583,12 +26580,12 @@ YY_RULE_SETUP +@@ -26583,12 +26542,12 @@ YY_RULE_SETUP } YY_BREAK case 52: -#line 779 "wcsbth.l" -+#line 776 "wcsbth.l" ++#line 741 "wcsbth.l" case 53: -#line 780 "wcsbth.l" -+#line 777 "wcsbth.l" ++#line 742 "wcsbth.l" case 54: YY_RULE_SETUP -#line 780 "wcsbth.l" -+#line 777 "wcsbth.l" ++#line 742 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.restfrq); -@@ -26616,10 +26613,10 @@ YY_RULE_SETUP +@@ -26616,10 +26575,10 @@ YY_RULE_SETUP } YY_BREAK case 55: -#line 807 "wcsbth.l" -+#line 804 "wcsbth.l" ++#line 769 "wcsbth.l" case 56: YY_RULE_SETUP -#line 807 "wcsbth.l" -+#line 804 "wcsbth.l" ++#line 769 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.restwav); -@@ -26635,7 +26632,7 @@ YY_RULE_SETUP +@@ -26635,7 +26594,7 @@ YY_RULE_SETUP YY_BREAK case 57: YY_RULE_SETUP -#line 820 "wcsbth.l" -+#line 817 "wcsbth.l" ++#line 782 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.pv); -@@ -26646,10 +26643,10 @@ YY_RULE_SETUP +@@ -26646,10 +26605,10 @@ YY_RULE_SETUP } YY_BREAK case 58: -#line 830 "wcsbth.l" -+#line 827 "wcsbth.l" ++#line 792 "wcsbth.l" case 59: YY_RULE_SETUP -#line 830 "wcsbth.l" -+#line 827 "wcsbth.l" ++#line 792 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.pv); -@@ -26667,10 +26664,10 @@ YY_RULE_SETUP +@@ -26667,10 +26626,10 @@ YY_RULE_SETUP } YY_BREAK case 60: -#line 847 "wcsbth.l" -+#line 844 "wcsbth.l" ++#line 809 "wcsbth.l" case 61: YY_RULE_SETUP -#line 847 "wcsbth.l" -+#line 844 "wcsbth.l" ++#line 809 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.pv); -@@ -26687,7 +26684,7 @@ YY_RULE_SETUP +@@ -26687,7 +26646,7 @@ YY_RULE_SETUP YY_BREAK case 62: YY_RULE_SETUP -#line 861 "wcsbth.l" -+#line 858 "wcsbth.l" ++#line 823 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.pv); -@@ -26699,7 +26696,7 @@ YY_RULE_SETUP +@@ -26699,7 +26658,7 @@ YY_RULE_SETUP YY_BREAK case 63: YY_RULE_SETUP -#line 870 "wcsbth.l" -+#line 867 "wcsbth.l" ++#line 832 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.ps); -@@ -26710,10 +26707,10 @@ YY_RULE_SETUP +@@ -26710,10 +26669,10 @@ YY_RULE_SETUP } YY_BREAK case 64: -#line 880 "wcsbth.l" -+#line 877 "wcsbth.l" ++#line 842 "wcsbth.l" case 65: YY_RULE_SETUP -#line 880 "wcsbth.l" -+#line 877 "wcsbth.l" ++#line 842 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.ps); -@@ -26731,10 +26728,10 @@ YY_RULE_SETUP +@@ -26731,10 +26690,10 @@ YY_RULE_SETUP } YY_BREAK case 66: -#line 897 "wcsbth.l" -+#line 894 "wcsbth.l" ++#line 859 "wcsbth.l" case 67: YY_RULE_SETUP -#line 897 "wcsbth.l" -+#line 894 "wcsbth.l" ++#line 859 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.ps); -@@ -26751,7 +26748,7 @@ YY_RULE_SETUP +@@ -26751,7 +26710,7 @@ YY_RULE_SETUP YY_BREAK case 68: YY_RULE_SETUP -#line 911 "wcsbth.l" -+#line 908 "wcsbth.l" ++#line 873 "wcsbth.l" { sscanf(yytext, "VELREF%c", &a); -@@ -26780,7 +26777,7 @@ YY_RULE_SETUP +@@ -26780,7 +26739,7 @@ YY_RULE_SETUP YY_BREAK case 69: YY_RULE_SETUP -#line 937 "wcsbth.l" -+#line 934 "wcsbth.l" ++#line 899 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.cname); -@@ -26790,10 +26787,10 @@ YY_RULE_SETUP +@@ -26790,10 +26749,10 @@ YY_RULE_SETUP } YY_BREAK case 70: -#line 946 "wcsbth.l" -+#line 943 "wcsbth.l" ++#line 908 "wcsbth.l" case 71: YY_RULE_SETUP -#line 946 "wcsbth.l" -+#line 943 "wcsbth.l" ++#line 908 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.cname); -@@ -26811,10 +26808,10 @@ YY_RULE_SETUP +@@ -26811,10 +26770,10 @@ YY_RULE_SETUP } YY_BREAK case 72: -#line 963 "wcsbth.l" -+#line 960 "wcsbth.l" ++#line 925 "wcsbth.l" case 73: YY_RULE_SETUP -#line 963 "wcsbth.l" -+#line 960 "wcsbth.l" ++#line 925 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.cname); -@@ -26831,7 +26828,7 @@ YY_RULE_SETUP +@@ -26831,7 +26790,7 @@ YY_RULE_SETUP YY_BREAK case 74: YY_RULE_SETUP -#line 977 "wcsbth.l" -+#line 974 "wcsbth.l" ++#line 939 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crder); -@@ -26841,10 +26838,10 @@ YY_RULE_SETUP +@@ -26841,10 +26800,10 @@ YY_RULE_SETUP } YY_BREAK case 75: -#line 986 "wcsbth.l" -+#line 983 "wcsbth.l" ++#line 948 "wcsbth.l" case 76: YY_RULE_SETUP -#line 986 "wcsbth.l" -+#line 983 "wcsbth.l" ++#line 948 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crder); -@@ -26862,10 +26859,10 @@ YY_RULE_SETUP +@@ -26862,10 +26821,10 @@ YY_RULE_SETUP } YY_BREAK case 77: -#line 1003 "wcsbth.l" -+#line 1000 "wcsbth.l" ++#line 965 "wcsbth.l" case 78: YY_RULE_SETUP -#line 1003 "wcsbth.l" -+#line 1000 "wcsbth.l" ++#line 965 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crder); -@@ -26882,7 +26879,7 @@ YY_RULE_SETUP +@@ -26882,7 +26841,7 @@ YY_RULE_SETUP YY_BREAK case 79: YY_RULE_SETUP -#line 1017 "wcsbth.l" -+#line 1014 "wcsbth.l" ++#line 979 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.csyer); -@@ -26892,10 +26889,10 @@ YY_RULE_SETUP +@@ -26892,10 +26851,10 @@ YY_RULE_SETUP } YY_BREAK case 80: -#line 1026 "wcsbth.l" -+#line 1023 "wcsbth.l" ++#line 988 "wcsbth.l" case 81: YY_RULE_SETUP -#line 1026 "wcsbth.l" -+#line 1023 "wcsbth.l" ++#line 988 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.csyer); -@@ -26913,10 +26910,10 @@ YY_RULE_SETUP +@@ -26913,10 +26872,10 @@ YY_RULE_SETUP } YY_BREAK case 82: -#line 1043 "wcsbth.l" -+#line 1040 "wcsbth.l" ++#line 1005 "wcsbth.l" case 83: YY_RULE_SETUP -#line 1043 "wcsbth.l" -+#line 1040 "wcsbth.l" ++#line 1005 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.csyer); -@@ -26933,7 +26930,7 @@ YY_RULE_SETUP +@@ -26933,7 +26892,7 @@ YY_RULE_SETUP YY_BREAK case 84: YY_RULE_SETUP -#line 1057 "wcsbth.l" -+#line 1054 "wcsbth.l" ++#line 1019 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.czphs); -@@ -26943,10 +26940,10 @@ YY_RULE_SETUP +@@ -26943,10 +26902,10 @@ YY_RULE_SETUP } YY_BREAK case 85: -#line 1066 "wcsbth.l" -+#line 1063 "wcsbth.l" ++#line 1028 "wcsbth.l" case 86: YY_RULE_SETUP -#line 1066 "wcsbth.l" -+#line 1063 "wcsbth.l" ++#line 1028 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.czphs); -@@ -26964,10 +26961,10 @@ YY_RULE_SETUP +@@ -26964,10 +26923,10 @@ YY_RULE_SETUP } YY_BREAK case 87: -#line 1083 "wcsbth.l" -+#line 1080 "wcsbth.l" ++#line 1045 "wcsbth.l" case 88: YY_RULE_SETUP -#line 1083 "wcsbth.l" -+#line 1080 "wcsbth.l" ++#line 1045 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.czphs); -@@ -26984,7 +26981,7 @@ YY_RULE_SETUP +@@ -26984,7 +26943,7 @@ YY_RULE_SETUP YY_BREAK case 89: YY_RULE_SETUP -#line 1097 "wcsbth.l" -+#line 1094 "wcsbth.l" ++#line 1059 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.cperi); -@@ -26994,10 +26991,10 @@ YY_RULE_SETUP +@@ -26994,10 +26953,10 @@ YY_RULE_SETUP } YY_BREAK case 90: -#line 1106 "wcsbth.l" -+#line 1103 "wcsbth.l" ++#line 1068 "wcsbth.l" case 91: YY_RULE_SETUP -#line 1106 "wcsbth.l" -+#line 1103 "wcsbth.l" ++#line 1068 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.cperi); -@@ -27015,10 +27012,10 @@ YY_RULE_SETUP +@@ -27015,10 +26974,10 @@ YY_RULE_SETUP } YY_BREAK case 92: -#line 1123 "wcsbth.l" -+#line 1120 "wcsbth.l" ++#line 1085 "wcsbth.l" case 93: YY_RULE_SETUP -#line 1123 "wcsbth.l" -+#line 1120 "wcsbth.l" ++#line 1085 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.cperi); -@@ -27034,12 +27031,12 @@ YY_RULE_SETUP +@@ -27034,12 +26993,12 @@ YY_RULE_SETUP } YY_BREAK case 94: -#line 1138 "wcsbth.l" -+#line 1135 "wcsbth.l" ++#line 1100 "wcsbth.l" case 95: -#line 1139 "wcsbth.l" -+#line 1136 "wcsbth.l" ++#line 1101 "wcsbth.l" case 96: YY_RULE_SETUP -#line 1139 "wcsbth.l" -+#line 1136 "wcsbth.l" ++#line 1101 "wcsbth.l" { valtype = STRING; vptr = wcstem.wcsname; -@@ -27061,7 +27058,7 @@ YY_RULE_SETUP +@@ -27061,7 +27020,7 @@ YY_RULE_SETUP YY_BREAK case 97: YY_RULE_SETUP -#line 1158 "wcsbth.l" -+#line 1155 "wcsbth.l" ++#line 1120 "wcsbth.l" { valtype = STRING; vptr = wcstem.timesys; -@@ -27071,10 +27068,10 @@ YY_RULE_SETUP +@@ -27071,10 +27030,10 @@ YY_RULE_SETUP } YY_BREAK case 98: -#line 1167 "wcsbth.l" -+#line 1164 "wcsbth.l" ++#line 1129 "wcsbth.l" case 99: YY_RULE_SETUP -#line 1167 "wcsbth.l" -+#line 1164 "wcsbth.l" ++#line 1129 "wcsbth.l" { valtype = STRING; vptr = wcstem.trefpos; -@@ -27090,10 +27087,10 @@ YY_RULE_SETUP +@@ -27090,10 +27049,10 @@ YY_RULE_SETUP } YY_BREAK case 100: -#line 1182 "wcsbth.l" -+#line 1179 "wcsbth.l" ++#line 1144 "wcsbth.l" case 101: YY_RULE_SETUP -#line 1182 "wcsbth.l" -+#line 1179 "wcsbth.l" ++#line 1144 "wcsbth.l" { valtype = STRING; vptr = wcstem.trefdir; -@@ -27110,7 +27107,7 @@ YY_RULE_SETUP +@@ -27110,7 +27069,7 @@ YY_RULE_SETUP YY_BREAK case 102: YY_RULE_SETUP -#line 1196 "wcsbth.l" -+#line 1193 "wcsbth.l" ++#line 1158 "wcsbth.l" { valtype = STRING; vptr = wcstem.plephem; -@@ -27121,7 +27118,7 @@ YY_RULE_SETUP +@@ -27121,7 +27080,7 @@ YY_RULE_SETUP YY_BREAK case 103: YY_RULE_SETUP -#line 1204 "wcsbth.l" -+#line 1201 "wcsbth.l" ++#line 1166 "wcsbth.l" { valtype = STRING; vptr = wcstem.timeunit; -@@ -27131,10 +27128,10 @@ YY_RULE_SETUP +@@ -27131,10 +27090,10 @@ YY_RULE_SETUP } YY_BREAK case 104: -#line 1213 "wcsbth.l" -+#line 1210 "wcsbth.l" ++#line 1175 "wcsbth.l" case 105: YY_RULE_SETUP -#line 1213 "wcsbth.l" -+#line 1210 "wcsbth.l" ++#line 1175 "wcsbth.l" { if ((yytext[4] == 'R') || (relax & WCSHDR_DATEREF)) { valtype = STRING; -@@ -27153,10 +27150,10 @@ YY_RULE_SETUP +@@ -27153,10 +27112,10 @@ YY_RULE_SETUP } YY_BREAK case 106: -#line 1231 "wcsbth.l" -+#line 1228 "wcsbth.l" ++#line 1193 "wcsbth.l" case 107: YY_RULE_SETUP -#line 1231 "wcsbth.l" -+#line 1228 "wcsbth.l" ++#line 1193 "wcsbth.l" { if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) { valtype = FLOAT2; -@@ -27175,13 +27172,13 @@ YY_RULE_SETUP +@@ -27175,13 +27134,13 @@ YY_RULE_SETUP } YY_BREAK case 108: -#line 1249 "wcsbth.l" -+#line 1246 "wcsbth.l" ++#line 1211 "wcsbth.l" case 109: YY_RULE_SETUP -#line 1249 "wcsbth.l" -+#line 1246 "wcsbth.l" ++#line 1211 "wcsbth.l" { if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) { - /* Actually integer, but treated as float. */ @@ -5550,42 +6468,42 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c valtype = FLOAT; vptr = wcstem.mjdref; -@@ -27198,10 +27195,10 @@ YY_RULE_SETUP +@@ -27198,10 +27157,10 @@ YY_RULE_SETUP } YY_BREAK case 110: -#line 1268 "wcsbth.l" -+#line 1265 "wcsbth.l" ++#line 1230 "wcsbth.l" case 111: YY_RULE_SETUP -#line 1268 "wcsbth.l" -+#line 1265 "wcsbth.l" ++#line 1230 "wcsbth.l" { if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) { valtype = FLOAT; -@@ -27220,10 +27217,10 @@ YY_RULE_SETUP +@@ -27220,10 +27179,10 @@ YY_RULE_SETUP } YY_BREAK case 112: -#line 1286 "wcsbth.l" -+#line 1283 "wcsbth.l" ++#line 1248 "wcsbth.l" case 113: YY_RULE_SETUP -#line 1286 "wcsbth.l" -+#line 1283 "wcsbth.l" ++#line 1248 "wcsbth.l" { if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) { valtype = FLOAT2; -@@ -27243,13 +27240,13 @@ YY_RULE_SETUP +@@ -27243,13 +27202,13 @@ YY_RULE_SETUP } YY_BREAK case 114: -#line 1305 "wcsbth.l" -+#line 1302 "wcsbth.l" ++#line 1267 "wcsbth.l" case 115: YY_RULE_SETUP -#line 1305 "wcsbth.l" -+#line 1302 "wcsbth.l" ++#line 1267 "wcsbth.l" { if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) { - /* Actually integer, but treated as float. */ @@ -5593,450 +6511,450 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c valtype = FLOAT; vptr = wcstem.mjdref; special = wcsbth_jdrefi; -@@ -27267,10 +27264,10 @@ YY_RULE_SETUP +@@ -27267,10 +27226,10 @@ YY_RULE_SETUP } YY_BREAK case 116: -#line 1325 "wcsbth.l" -+#line 1322 "wcsbth.l" ++#line 1287 "wcsbth.l" case 117: YY_RULE_SETUP -#line 1325 "wcsbth.l" -+#line 1322 "wcsbth.l" ++#line 1287 "wcsbth.l" { if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) { valtype = FLOAT; -@@ -27291,7 +27288,7 @@ YY_RULE_SETUP +@@ -27291,7 +27250,7 @@ YY_RULE_SETUP YY_BREAK case 118: YY_RULE_SETUP -#line 1343 "wcsbth.l" -+#line 1340 "wcsbth.l" ++#line 1305 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.timeoffs); -@@ -27302,7 +27299,7 @@ YY_RULE_SETUP +@@ -27302,7 +27261,7 @@ YY_RULE_SETUP YY_BREAK case 119: YY_RULE_SETUP -#line 1351 "wcsbth.l" -+#line 1348 "wcsbth.l" ++#line 1313 "wcsbth.l" { valtype = STRING; vptr = wcstem.dateobs; -@@ -27314,12 +27311,12 @@ YY_RULE_SETUP +@@ -27314,12 +27273,12 @@ YY_RULE_SETUP } YY_BREAK case 120: -#line 1362 "wcsbth.l" -+#line 1359 "wcsbth.l" ++#line 1324 "wcsbth.l" case 121: -#line 1363 "wcsbth.l" -+#line 1360 "wcsbth.l" ++#line 1325 "wcsbth.l" case 122: YY_RULE_SETUP -#line 1363 "wcsbth.l" -+#line 1360 "wcsbth.l" ++#line 1325 "wcsbth.l" { valtype = STRING; vptr = wcstem.dateobs; -@@ -27341,7 +27338,7 @@ YY_RULE_SETUP +@@ -27341,7 +27300,7 @@ YY_RULE_SETUP YY_BREAK case 123: YY_RULE_SETUP -#line 1382 "wcsbth.l" -+#line 1379 "wcsbth.l" ++#line 1344 "wcsbth.l" { valtype = STRING; vptr = wcstem.datebeg; -@@ -27352,10 +27349,10 @@ YY_RULE_SETUP +@@ -27352,10 +27311,10 @@ YY_RULE_SETUP } YY_BREAK case 124: -#line 1392 "wcsbth.l" -+#line 1389 "wcsbth.l" ++#line 1354 "wcsbth.l" case 125: YY_RULE_SETUP -#line 1392 "wcsbth.l" -+#line 1389 "wcsbth.l" ++#line 1354 "wcsbth.l" { valtype = STRING; vptr = wcstem.dateavg; -@@ -27372,7 +27369,7 @@ YY_RULE_SETUP +@@ -27372,7 +27331,7 @@ YY_RULE_SETUP YY_BREAK case 126: YY_RULE_SETUP -#line 1406 "wcsbth.l" -+#line 1403 "wcsbth.l" ++#line 1368 "wcsbth.l" { valtype = STRING; vptr = wcstem.dateend; -@@ -27383,10 +27380,10 @@ YY_RULE_SETUP +@@ -27383,10 +27342,10 @@ YY_RULE_SETUP } YY_BREAK case 127: -#line 1416 "wcsbth.l" -+#line 1413 "wcsbth.l" ++#line 1378 "wcsbth.l" case 128: YY_RULE_SETUP -#line 1416 "wcsbth.l" -+#line 1413 "wcsbth.l" ++#line 1378 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.mjdobs); -@@ -27404,7 +27401,7 @@ YY_RULE_SETUP +@@ -27404,7 +27363,7 @@ YY_RULE_SETUP YY_BREAK case 129: YY_RULE_SETUP -#line 1431 "wcsbth.l" -+#line 1428 "wcsbth.l" ++#line 1393 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.mjdbeg); -@@ -27415,10 +27412,10 @@ YY_RULE_SETUP +@@ -27415,10 +27374,10 @@ YY_RULE_SETUP } YY_BREAK case 130: -#line 1441 "wcsbth.l" -+#line 1438 "wcsbth.l" ++#line 1403 "wcsbth.l" case 131: YY_RULE_SETUP -#line 1441 "wcsbth.l" -+#line 1438 "wcsbth.l" ++#line 1403 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.mjdavg); -@@ -27435,7 +27432,7 @@ YY_RULE_SETUP +@@ -27435,7 +27394,7 @@ YY_RULE_SETUP YY_BREAK case 132: YY_RULE_SETUP -#line 1455 "wcsbth.l" -+#line 1452 "wcsbth.l" ++#line 1417 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.mjdend); -@@ -27447,7 +27444,7 @@ YY_RULE_SETUP +@@ -27447,7 +27406,7 @@ YY_RULE_SETUP YY_BREAK case 133: YY_RULE_SETUP -#line 1464 "wcsbth.l" -+#line 1461 "wcsbth.l" ++#line 1426 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.jepoch); -@@ -27459,7 +27456,7 @@ YY_RULE_SETUP +@@ -27459,7 +27418,7 @@ YY_RULE_SETUP YY_BREAK case 134: YY_RULE_SETUP -#line 1473 "wcsbth.l" -+#line 1470 "wcsbth.l" ++#line 1435 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.bepoch); -@@ -27471,7 +27468,7 @@ YY_RULE_SETUP +@@ -27471,7 +27430,7 @@ YY_RULE_SETUP YY_BREAK case 135: YY_RULE_SETUP -#line 1482 "wcsbth.l" -+#line 1479 "wcsbth.l" ++#line 1444 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.tstart); -@@ -27483,7 +27480,7 @@ YY_RULE_SETUP +@@ -27483,7 +27442,7 @@ YY_RULE_SETUP YY_BREAK case 136: YY_RULE_SETUP -#line 1491 "wcsbth.l" -+#line 1488 "wcsbth.l" ++#line 1453 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.tstop); -@@ -27495,7 +27492,7 @@ YY_RULE_SETUP +@@ -27495,7 +27454,7 @@ YY_RULE_SETUP YY_BREAK case 137: YY_RULE_SETUP -#line 1500 "wcsbth.l" -+#line 1497 "wcsbth.l" ++#line 1462 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.xposure); -@@ -27507,7 +27504,7 @@ YY_RULE_SETUP +@@ -27507,7 +27466,7 @@ YY_RULE_SETUP YY_BREAK case 138: YY_RULE_SETUP -#line 1509 "wcsbth.l" -+#line 1506 "wcsbth.l" ++#line 1471 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.telapse); -@@ -27519,7 +27516,7 @@ YY_RULE_SETUP +@@ -27519,7 +27478,7 @@ YY_RULE_SETUP YY_BREAK case 139: YY_RULE_SETUP -#line 1518 "wcsbth.l" -+#line 1515 "wcsbth.l" ++#line 1480 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.timsyer); -@@ -27531,7 +27528,7 @@ YY_RULE_SETUP +@@ -27531,7 +27490,7 @@ YY_RULE_SETUP YY_BREAK case 140: YY_RULE_SETUP -#line 1527 "wcsbth.l" -+#line 1524 "wcsbth.l" ++#line 1489 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.timrder); -@@ -27543,7 +27540,7 @@ YY_RULE_SETUP +@@ -27543,7 +27502,7 @@ YY_RULE_SETUP YY_BREAK case 141: YY_RULE_SETUP -#line 1536 "wcsbth.l" -+#line 1533 "wcsbth.l" ++#line 1498 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.timedel); -@@ -27555,7 +27552,7 @@ YY_RULE_SETUP +@@ -27555,7 +27514,7 @@ YY_RULE_SETUP YY_BREAK case 142: YY_RULE_SETUP -#line 1545 "wcsbth.l" -+#line 1542 "wcsbth.l" ++#line 1507 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.timepixr); -@@ -27567,10 +27564,10 @@ YY_RULE_SETUP +@@ -27567,10 +27526,10 @@ YY_RULE_SETUP } YY_BREAK case 143: -#line 1556 "wcsbth.l" -+#line 1553 "wcsbth.l" ++#line 1518 "wcsbth.l" case 144: YY_RULE_SETUP -#line 1556 "wcsbth.l" -+#line 1553 "wcsbth.l" ++#line 1518 "wcsbth.l" { valtype = FLOAT; vptr = wcstem.obsgeo; -@@ -27586,10 +27583,10 @@ YY_RULE_SETUP +@@ -27586,10 +27545,10 @@ YY_RULE_SETUP } YY_BREAK case 145: -#line 1571 "wcsbth.l" -+#line 1568 "wcsbth.l" ++#line 1533 "wcsbth.l" case 146: YY_RULE_SETUP -#line 1571 "wcsbth.l" -+#line 1568 "wcsbth.l" ++#line 1533 "wcsbth.l" { valtype = FLOAT; vptr = wcstem.obsgeo + 1; -@@ -27605,10 +27602,10 @@ YY_RULE_SETUP +@@ -27605,10 +27564,10 @@ YY_RULE_SETUP } YY_BREAK case 147: -#line 1586 "wcsbth.l" -+#line 1583 "wcsbth.l" ++#line 1548 "wcsbth.l" case 148: YY_RULE_SETUP -#line 1586 "wcsbth.l" -+#line 1583 "wcsbth.l" ++#line 1548 "wcsbth.l" { valtype = FLOAT; vptr = wcstem.obsgeo + 2; -@@ -27625,7 +27622,7 @@ YY_RULE_SETUP +@@ -27625,7 +27584,7 @@ YY_RULE_SETUP YY_BREAK case 149: YY_RULE_SETUP -#line 1600 "wcsbth.l" -+#line 1597 "wcsbth.l" ++#line 1562 "wcsbth.l" { valtype = FLOAT; vptr = wcstem.obsgeo + 3; -@@ -27636,12 +27633,12 @@ YY_RULE_SETUP +@@ -27636,12 +27595,12 @@ YY_RULE_SETUP } YY_BREAK case 150: -#line 1610 "wcsbth.l" -+#line 1607 "wcsbth.l" ++#line 1572 "wcsbth.l" case 151: -#line 1611 "wcsbth.l" -+#line 1608 "wcsbth.l" ++#line 1573 "wcsbth.l" case 152: YY_RULE_SETUP -#line 1611 "wcsbth.l" -+#line 1608 "wcsbth.l" ++#line 1573 "wcsbth.l" { valtype = STRING; vptr = wcstem.obsgeo + 3; -@@ -27663,7 +27660,7 @@ YY_RULE_SETUP +@@ -27663,7 +27622,7 @@ YY_RULE_SETUP YY_BREAK case 153: YY_RULE_SETUP -#line 1630 "wcsbth.l" -+#line 1627 "wcsbth.l" ++#line 1592 "wcsbth.l" { valtype = FLOAT; vptr = wcstem.obsgeo + 4; -@@ -27674,12 +27671,12 @@ YY_RULE_SETUP +@@ -27674,12 +27633,12 @@ YY_RULE_SETUP } YY_BREAK case 154: -#line 1640 "wcsbth.l" -+#line 1637 "wcsbth.l" ++#line 1602 "wcsbth.l" case 155: -#line 1641 "wcsbth.l" -+#line 1638 "wcsbth.l" ++#line 1603 "wcsbth.l" case 156: YY_RULE_SETUP -#line 1641 "wcsbth.l" -+#line 1638 "wcsbth.l" ++#line 1603 "wcsbth.l" { valtype = STRING; vptr = wcstem.obsgeo + 3; -@@ -27701,7 +27698,7 @@ YY_RULE_SETUP +@@ -27701,7 +27660,7 @@ YY_RULE_SETUP YY_BREAK case 157: YY_RULE_SETUP -#line 1660 "wcsbth.l" -+#line 1657 "wcsbth.l" ++#line 1622 "wcsbth.l" { valtype = FLOAT; vptr = wcstem.obsgeo + 5; -@@ -27712,12 +27709,12 @@ YY_RULE_SETUP +@@ -27712,12 +27671,12 @@ YY_RULE_SETUP } YY_BREAK case 158: -#line 1670 "wcsbth.l" -+#line 1667 "wcsbth.l" ++#line 1632 "wcsbth.l" case 159: -#line 1671 "wcsbth.l" -+#line 1668 "wcsbth.l" ++#line 1633 "wcsbth.l" case 160: YY_RULE_SETUP -#line 1671 "wcsbth.l" -+#line 1668 "wcsbth.l" ++#line 1633 "wcsbth.l" { valtype = STRING; vptr = wcstem.obsgeo + 3; -@@ -27739,7 +27736,7 @@ YY_RULE_SETUP +@@ -27739,7 +27698,7 @@ YY_RULE_SETUP YY_BREAK case 161: YY_RULE_SETUP -#line 1690 "wcsbth.l" -+#line 1687 "wcsbth.l" ++#line 1652 "wcsbth.l" { valtype = STRING; vptr = wcstem.obsorbit; -@@ -27749,10 +27746,10 @@ YY_RULE_SETUP +@@ -27749,10 +27708,10 @@ YY_RULE_SETUP } YY_BREAK case 162: -#line 1699 "wcsbth.l" -+#line 1696 "wcsbth.l" ++#line 1661 "wcsbth.l" case 163: YY_RULE_SETUP -#line 1699 "wcsbth.l" -+#line 1696 "wcsbth.l" ++#line 1661 "wcsbth.l" { valtype = STRING; vptr = wcstem.radesys; -@@ -27769,7 +27766,7 @@ YY_RULE_SETUP +@@ -27769,7 +27728,7 @@ YY_RULE_SETUP YY_BREAK case 164: YY_RULE_SETUP -#line 1713 "wcsbth.l" -+#line 1710 "wcsbth.l" ++#line 1675 "wcsbth.l" { if (relax & WCSHDR_RADECSYS) { valtype = STRING; -@@ -27792,7 +27789,7 @@ YY_RULE_SETUP +@@ -27792,7 +27751,7 @@ YY_RULE_SETUP YY_BREAK case 165: YY_RULE_SETUP -#line 1733 "wcsbth.l" -+#line 1730 "wcsbth.l" ++#line 1695 "wcsbth.l" { sscanf(yytext, "EPOCH%c", &a); -@@ -27821,10 +27818,10 @@ YY_RULE_SETUP +@@ -27821,10 +27780,10 @@ YY_RULE_SETUP } YY_BREAK case 166: -#line 1761 "wcsbth.l" -+#line 1758 "wcsbth.l" ++#line 1723 "wcsbth.l" case 167: YY_RULE_SETUP -#line 1761 "wcsbth.l" -+#line 1758 "wcsbth.l" ++#line 1723 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.equinox); -@@ -27840,10 +27837,10 @@ YY_RULE_SETUP +@@ -27840,10 +27799,10 @@ YY_RULE_SETUP } YY_BREAK case 168: -#line 1776 "wcsbth.l" -+#line 1773 "wcsbth.l" ++#line 1738 "wcsbth.l" case 169: YY_RULE_SETUP -#line 1776 "wcsbth.l" -+#line 1773 "wcsbth.l" ++#line 1738 "wcsbth.l" { valtype = STRING; vptr = wcstem.specsys; -@@ -27858,10 +27855,10 @@ YY_RULE_SETUP +@@ -27858,10 +27817,10 @@ YY_RULE_SETUP } YY_BREAK case 170: -#line 1790 "wcsbth.l" -+#line 1787 "wcsbth.l" ++#line 1752 "wcsbth.l" case 171: YY_RULE_SETUP -#line 1790 "wcsbth.l" -+#line 1787 "wcsbth.l" ++#line 1752 "wcsbth.l" { valtype = STRING; vptr = wcstem.ssysobs; -@@ -27876,10 +27873,10 @@ YY_RULE_SETUP +@@ -27876,10 +27835,10 @@ YY_RULE_SETUP } YY_BREAK case 172: -#line 1804 "wcsbth.l" -+#line 1801 "wcsbth.l" ++#line 1766 "wcsbth.l" case 173: YY_RULE_SETUP -#line 1804 "wcsbth.l" -+#line 1801 "wcsbth.l" ++#line 1766 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.velosys); -@@ -27895,7 +27892,7 @@ YY_RULE_SETUP +@@ -27895,7 +27854,7 @@ YY_RULE_SETUP YY_BREAK case 174: YY_RULE_SETUP -#line 1817 "wcsbth.l" -+#line 1814 "wcsbth.l" ++#line 1779 "wcsbth.l" { if (relax & WCSHDR_VSOURCE) { valtype = FLOAT; -@@ -27917,12 +27914,12 @@ YY_RULE_SETUP +@@ -27917,12 +27876,12 @@ YY_RULE_SETUP } YY_BREAK case 175: -#line 1838 "wcsbth.l" -+#line 1835 "wcsbth.l" ++#line 1800 "wcsbth.l" case 176: -#line 1839 "wcsbth.l" -+#line 1836 "wcsbth.l" ++#line 1801 "wcsbth.l" case 177: YY_RULE_SETUP -#line 1839 "wcsbth.l" -+#line 1836 "wcsbth.l" ++#line 1801 "wcsbth.l" { if (relax & WCSHDR_VSOURCE) { valtype = FLOAT; -@@ -27938,16 +27935,16 @@ YY_RULE_SETUP +@@ -27938,16 +27897,16 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6048,119 +6966,124 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 178: -#line 1860 "wcsbth.l" -+#line 1857 "wcsbth.l" ++#line 1822 "wcsbth.l" case 179: YY_RULE_SETUP -#line 1860 "wcsbth.l" -+#line 1857 "wcsbth.l" ++#line 1822 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.zsource); -@@ -27962,10 +27959,10 @@ YY_RULE_SETUP +@@ -27962,10 +27921,10 @@ YY_RULE_SETUP } YY_BREAK case 180: -#line 1874 "wcsbth.l" -+#line 1871 "wcsbth.l" ++#line 1836 "wcsbth.l" case 181: YY_RULE_SETUP -#line 1874 "wcsbth.l" -+#line 1871 "wcsbth.l" ++#line 1836 "wcsbth.l" { valtype = STRING; vptr = wcstem.ssyssrc; -@@ -27980,10 +27977,10 @@ YY_RULE_SETUP +@@ -27980,10 +27939,10 @@ YY_RULE_SETUP } YY_BREAK case 182: -#line 1888 "wcsbth.l" -+#line 1885 "wcsbth.l" ++#line 1850 "wcsbth.l" case 183: YY_RULE_SETUP -#line 1888 "wcsbth.l" -+#line 1885 "wcsbth.l" ++#line 1850 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.velangl); -@@ -27999,7 +27996,7 @@ YY_RULE_SETUP +@@ -27999,7 +27958,7 @@ YY_RULE_SETUP YY_BREAK case 184: YY_RULE_SETUP -#line 1901 "wcsbth.l" -+#line 1898 "wcsbth.l" ++#line 1863 "wcsbth.l" { valtype = FLOAT; auxprm = 1; -@@ -28011,7 +28008,7 @@ YY_RULE_SETUP +@@ -28011,7 +27970,7 @@ YY_RULE_SETUP YY_BREAK case 185: YY_RULE_SETUP -#line 1910 "wcsbth.l" -+#line 1907 "wcsbth.l" ++#line 1872 "wcsbth.l" { valtype = FLOAT; auxprm = 1; -@@ -28023,7 +28020,7 @@ YY_RULE_SETUP +@@ -28023,7 +27982,7 @@ YY_RULE_SETUP YY_BREAK case 186: YY_RULE_SETUP -#line 1919 "wcsbth.l" -+#line 1916 "wcsbth.l" ++#line 1881 "wcsbth.l" { valtype = FLOAT; auxprm = 1; -@@ -28035,7 +28032,7 @@ YY_RULE_SETUP +@@ -28035,7 +27994,7 @@ YY_RULE_SETUP YY_BREAK case 187: YY_RULE_SETUP -#line 1928 "wcsbth.l" -+#line 1925 "wcsbth.l" ++#line 1890 "wcsbth.l" { valtype = FLOAT; auxprm = 1; -@@ -28046,10 +28043,10 @@ YY_RULE_SETUP +@@ -28046,10 +28005,10 @@ YY_RULE_SETUP } YY_BREAK case 188: -#line 1938 "wcsbth.l" -+#line 1935 "wcsbth.l" ++#line 1900 "wcsbth.l" case 189: YY_RULE_SETUP -#line 1938 "wcsbth.l" -+#line 1935 "wcsbth.l" ++#line 1900 "wcsbth.l" { valtype = FLOAT; auxprm = 1; -@@ -28061,7 +28058,7 @@ YY_RULE_SETUP +@@ -28061,10 +28020,10 @@ YY_RULE_SETUP YY_BREAK case 190: YY_RULE_SETUP -#line 1947 "wcsbth.l" -+#line 1944 "wcsbth.l" ++#line 1909 "wcsbth.l" { - if (wcsbth_nkeyrec) { - wcsbth_nkeyrec = 0; -@@ -28074,16 +28071,16 @@ YY_RULE_SETUP +- if (wcsbth_nkeyrec) { +- wcsbth_nkeyrec = 0; ++ if (yyextra->nkeyrec) { ++ yyextra->nkeyrec = 0; + errmsg = "keyrecords following the END keyrecord were ignored"; + BEGIN(ERROR); + } else { +@@ -28074,16 +28033,16 @@ YY_RULE_SETUP YY_BREAK case 191: YY_RULE_SETUP -#line 1957 "wcsbth.l" -+#line 1954 "wcsbth.l" ++#line 1919 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 192: -#line 1962 "wcsbth.l" -+#line 1959 "wcsbth.l" ++#line 1924 "wcsbth.l" case 193: YY_RULE_SETUP -#line 1962 "wcsbth.l" -+#line 1959 "wcsbth.l" ++#line 1924 "wcsbth.l" { if (relax & WCSHDR_ALLIMG) { sscanf(yytext, "%d%c", &i, &a); -@@ -28097,26 +28094,26 @@ YY_RULE_SETUP +@@ -28097,26 +28056,26 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6172,11 +7095,11 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 194: -#line 1981 "wcsbth.l" -+#line 1978 "wcsbth.l" ++#line 1943 "wcsbth.l" case 195: YY_RULE_SETUP -#line 1981 "wcsbth.l" -+#line 1978 "wcsbth.l" ++#line 1943 "wcsbth.l" { if (relax & WCSHDR_ALLIMG) { if (relax & WCSHDR_reject) { @@ -6192,7 +7115,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c BEGIN(DISCARD); } -@@ -28127,21 +28124,21 @@ YY_RULE_SETUP +@@ -28127,21 +28086,21 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6204,14 +7127,14 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 196: -#line 2007 "wcsbth.l" -+#line 2004 "wcsbth.l" ++#line 1969 "wcsbth.l" case 197: -#line 2008 "wcsbth.l" -+#line 2005 "wcsbth.l" ++#line 1970 "wcsbth.l" case 198: YY_RULE_SETUP -#line 2008 "wcsbth.l" -+#line 2005 "wcsbth.l" ++#line 1970 "wcsbth.l" { - /* Anything that has fallen through to this point must contain */ - /* an invalid axis number. */ @@ -6220,7 +7143,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c if (relax & WCSHDR_ALLIMG) { errmsg = "axis number must exceed 0"; BEGIN(ERROR); -@@ -28153,41 +28150,41 @@ YY_RULE_SETUP +@@ -28153,41 +28112,41 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6233,7 +7156,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c case 199: YY_RULE_SETUP -#line 2027 "wcsbth.l" -+#line 2024 "wcsbth.l" ++#line 1989 "wcsbth.l" { if (relax & WCSHDR_reject) { - /* Looks too much like a FITS WCS keyword not to flag it. */ @@ -6252,46 +7175,46 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 200: -#line 2042 "wcsbth.l" -+#line 2039 "wcsbth.l" ++#line 2004 "wcsbth.l" case 201: -#line 2043 "wcsbth.l" -+#line 2040 "wcsbth.l" ++#line 2005 "wcsbth.l" case 202: -#line 2044 "wcsbth.l" -+#line 2041 "wcsbth.l" ++#line 2006 "wcsbth.l" case 203: -#line 2045 "wcsbth.l" -+#line 2042 "wcsbth.l" ++#line 2007 "wcsbth.l" case 204: -#line 2046 "wcsbth.l" -+#line 2043 "wcsbth.l" ++#line 2008 "wcsbth.l" case 205: YY_RULE_SETUP -#line 2046 "wcsbth.l" -+#line 2043 "wcsbth.l" ++#line 2008 "wcsbth.l" { if (vptr) { WCSBTH_PUTBACK; -@@ -28204,14 +28201,14 @@ YY_RULE_SETUP +@@ -28204,14 +28163,14 @@ YY_RULE_SETUP } YY_BREAK case 206: -#line 2062 "wcsbth.l" -+#line 2059 "wcsbth.l" ++#line 2024 "wcsbth.l" case 207: -#line 2063 "wcsbth.l" -+#line 2060 "wcsbth.l" ++#line 2025 "wcsbth.l" case 208: -#line 2064 "wcsbth.l" -+#line 2061 "wcsbth.l" ++#line 2026 "wcsbth.l" case 209: YY_RULE_SETUP -#line 2064 "wcsbth.l" -+#line 2061 "wcsbth.l" ++#line 2026 "wcsbth.l" { if (vptr && (relax & WCSHDR_LONGKEY)) { WCSBTH_PUTBACK; -@@ -28228,33 +28225,33 @@ YY_RULE_SETUP +@@ -28228,33 +28187,33 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6303,68 +7226,68 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 210: -#line 2086 "wcsbth.l" -+#line 2083 "wcsbth.l" ++#line 2048 "wcsbth.l" case 211: YY_RULE_SETUP -#line 2086 "wcsbth.l" -+#line 2083 "wcsbth.l" ++#line 2048 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 212: -#line 2091 "wcsbth.l" -+#line 2088 "wcsbth.l" ++#line 2053 "wcsbth.l" case 213: -#line 2092 "wcsbth.l" -+#line 2089 "wcsbth.l" ++#line 2054 "wcsbth.l" case 214: -#line 2093 "wcsbth.l" -+#line 2090 "wcsbth.l" ++#line 2055 "wcsbth.l" case 215: -#line 2094 "wcsbth.l" -+#line 2091 "wcsbth.l" ++#line 2056 "wcsbth.l" case 216: -#line 2095 "wcsbth.l" -+#line 2092 "wcsbth.l" ++#line 2057 "wcsbth.l" case 217: YY_RULE_SETUP -#line 2095 "wcsbth.l" -+#line 2092 "wcsbth.l" ++#line 2057 "wcsbth.l" { sscanf(yytext, "%d%c", &n, &a); if (YY_START == TCCCna) i = wcsbth_colax(*wcs, &alts, n, a); -@@ -28263,23 +28260,23 @@ YY_RULE_SETUP +@@ -28263,23 +28222,23 @@ YY_RULE_SETUP } YY_BREAK case 218: -#line 2103 "wcsbth.l" -+#line 2100 "wcsbth.l" ++#line 2065 "wcsbth.l" case 219: YY_RULE_SETUP -#line 2103 "wcsbth.l" -+#line 2100 "wcsbth.l" ++#line 2065 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 220: -#line 2108 "wcsbth.l" -+#line 2105 "wcsbth.l" ++#line 2070 "wcsbth.l" case 221: -#line 2109 "wcsbth.l" -+#line 2106 "wcsbth.l" ++#line 2071 "wcsbth.l" case 222: -#line 2110 "wcsbth.l" -+#line 2107 "wcsbth.l" ++#line 2072 "wcsbth.l" case 223: YY_RULE_SETUP -#line 2110 "wcsbth.l" -+#line 2107 "wcsbth.l" ++#line 2072 "wcsbth.l" { if (relax & WCSHDR_ALLIMG) { sscanf(yytext, "%d_%d%c", &i, &j, &a); -@@ -28293,54 +28290,54 @@ YY_RULE_SETUP +@@ -28293,54 +28252,54 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6376,72 +7299,72 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 224: -#line 2129 "wcsbth.l" -+#line 2126 "wcsbth.l" ++#line 2091 "wcsbth.l" case 225: -#line 2130 "wcsbth.l" -+#line 2127 "wcsbth.l" ++#line 2092 "wcsbth.l" case 226: -#line 2131 "wcsbth.l" -+#line 2128 "wcsbth.l" ++#line 2093 "wcsbth.l" case 227: -#line 2132 "wcsbth.l" -+#line 2129 "wcsbth.l" ++#line 2094 "wcsbth.l" case 228: -#line 2133 "wcsbth.l" -+#line 2130 "wcsbth.l" ++#line 2095 "wcsbth.l" case 229: -#line 2134 "wcsbth.l" -+#line 2131 "wcsbth.l" ++#line 2096 "wcsbth.l" case 230: -#line 2135 "wcsbth.l" -+#line 2132 "wcsbth.l" ++#line 2097 "wcsbth.l" case 231: -#line 2136 "wcsbth.l" -+#line 2133 "wcsbth.l" ++#line 2098 "wcsbth.l" case 232: -#line 2137 "wcsbth.l" -+#line 2134 "wcsbth.l" ++#line 2099 "wcsbth.l" case 233: -#line 2138 "wcsbth.l" -+#line 2135 "wcsbth.l" ++#line 2100 "wcsbth.l" case 234: -#line 2139 "wcsbth.l" -+#line 2136 "wcsbth.l" ++#line 2101 "wcsbth.l" case 235: -#line 2140 "wcsbth.l" -+#line 2137 "wcsbth.l" ++#line 2102 "wcsbth.l" case 236: -#line 2141 "wcsbth.l" -+#line 2138 "wcsbth.l" ++#line 2103 "wcsbth.l" case 237: -#line 2142 "wcsbth.l" -+#line 2139 "wcsbth.l" ++#line 2104 "wcsbth.l" case 238: -#line 2143 "wcsbth.l" -+#line 2140 "wcsbth.l" ++#line 2105 "wcsbth.l" case 239: -#line 2144 "wcsbth.l" -+#line 2141 "wcsbth.l" ++#line 2106 "wcsbth.l" case 240: -#line 2145 "wcsbth.l" -+#line 2142 "wcsbth.l" ++#line 2107 "wcsbth.l" case 241: -#line 2146 "wcsbth.l" -+#line 2143 "wcsbth.l" ++#line 2108 "wcsbth.l" case 242: -#line 2147 "wcsbth.l" -+#line 2144 "wcsbth.l" ++#line 2109 "wcsbth.l" case 243: -#line 2148 "wcsbth.l" -+#line 2145 "wcsbth.l" ++#line 2110 "wcsbth.l" case 244: YY_RULE_SETUP -#line 2148 "wcsbth.l" -+#line 2145 "wcsbth.l" ++#line 2110 "wcsbth.l" { if (relax & WCSHDR_ALLIMG) { if (((altlin == 1) && (relax & WCSHDR_PC0i_0ja)) || -@@ -28355,7 +28352,7 @@ YY_RULE_SETUP +@@ -28355,7 +28314,7 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6450,7 +7373,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c BEGIN(DISCARD); } -@@ -28366,35 +28363,35 @@ YY_RULE_SETUP +@@ -28366,35 +28325,35 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6462,35 +7385,35 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 245: -#line 2179 "wcsbth.l" -+#line 2176 "wcsbth.l" ++#line 2141 "wcsbth.l" case 246: -#line 2180 "wcsbth.l" -+#line 2177 "wcsbth.l" ++#line 2142 "wcsbth.l" case 247: -#line 2181 "wcsbth.l" -+#line 2178 "wcsbth.l" ++#line 2143 "wcsbth.l" case 248: -#line 2182 "wcsbth.l" -+#line 2179 "wcsbth.l" ++#line 2144 "wcsbth.l" case 249: -#line 2183 "wcsbth.l" -+#line 2180 "wcsbth.l" ++#line 2145 "wcsbth.l" case 250: -#line 2184 "wcsbth.l" -+#line 2181 "wcsbth.l" ++#line 2146 "wcsbth.l" case 251: -#line 2185 "wcsbth.l" -+#line 2182 "wcsbth.l" ++#line 2147 "wcsbth.l" case 252: -#line 2186 "wcsbth.l" -+#line 2183 "wcsbth.l" ++#line 2148 "wcsbth.l" case 253: -#line 2187 "wcsbth.l" -+#line 2184 "wcsbth.l" ++#line 2149 "wcsbth.l" case 254: YY_RULE_SETUP -#line 2187 "wcsbth.l" -+#line 2184 "wcsbth.l" ++#line 2149 "wcsbth.l" { - /* Anything that has fallen through to this point must contain */ - /* an invalid axis number. */ @@ -6499,7 +7422,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c if (relax & WCSHDR_ALLIMG) { errmsg = "axis number must exceed 0"; BEGIN(ERROR); -@@ -28406,32 +28403,32 @@ YY_RULE_SETUP +@@ -28406,32 +28365,32 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6511,39 +7434,39 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 255: -#line 2207 "wcsbth.l" -+#line 2204 "wcsbth.l" ++#line 2169 "wcsbth.l" case 256: -#line 2208 "wcsbth.l" -+#line 2205 "wcsbth.l" ++#line 2170 "wcsbth.l" case 257: -#line 2209 "wcsbth.l" -+#line 2206 "wcsbth.l" ++#line 2171 "wcsbth.l" case 258: -#line 2210 "wcsbth.l" -+#line 2207 "wcsbth.l" ++#line 2172 "wcsbth.l" case 259: -#line 2211 "wcsbth.l" -+#line 2208 "wcsbth.l" ++#line 2173 "wcsbth.l" case 260: -#line 2212 "wcsbth.l" -+#line 2209 "wcsbth.l" ++#line 2174 "wcsbth.l" case 261: -#line 2213 "wcsbth.l" -+#line 2210 "wcsbth.l" ++#line 2175 "wcsbth.l" case 262: -#line 2214 "wcsbth.l" -+#line 2211 "wcsbth.l" ++#line 2176 "wcsbth.l" case 263: -#line 2215 "wcsbth.l" -+#line 2212 "wcsbth.l" ++#line 2177 "wcsbth.l" case 264: YY_RULE_SETUP -#line 2215 "wcsbth.l" -+#line 2212 "wcsbth.l" ++#line 2177 "wcsbth.l" { if (relax & WCSHDR_ALLIMG) { errmsg = errtxt; -@@ -28446,16 +28443,16 @@ YY_RULE_SETUP +@@ -28446,16 +28405,16 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6556,14 +7479,14 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c case 265: YY_RULE_SETUP -#line 2234 "wcsbth.l" -+#line 2231 "wcsbth.l" ++#line 2196 "wcsbth.l" { - /* This covers the defunct forms CD00i00j and PC00i00j. */ + // This covers the defunct forms CD00i00j and PC00i00j. if (relax & WCSHDR_ALLIMG) { if (((altlin == 1) && (relax & WCSHDR_PC00i00j)) || ((altlin == 2) && (relax & WCSHDR_CD00i00j))) { -@@ -28472,7 +28469,7 @@ YY_RULE_SETUP +@@ -28472,7 +28431,7 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6572,7 +7495,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c BEGIN(DISCARD); } -@@ -28483,25 +28480,25 @@ YY_RULE_SETUP +@@ -28483,25 +28442,25 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6585,50 +7508,50 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c case 266: YY_RULE_SETUP -#line 2268 "wcsbth.l" -+#line 2265 "wcsbth.l" ++#line 2230 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 267: -#line 2273 "wcsbth.l" -+#line 2270 "wcsbth.l" ++#line 2235 "wcsbth.l" case 268: -#line 2274 "wcsbth.l" -+#line 2271 "wcsbth.l" ++#line 2236 "wcsbth.l" case 269: YY_RULE_SETUP -#line 2274 "wcsbth.l" -+#line 2271 "wcsbth.l" ++#line 2236 "wcsbth.l" { sscanf(yytext, "%d%c", &n, &a); keytype = BIMGARR; -@@ -28509,18 +28506,18 @@ YY_RULE_SETUP +@@ -28509,18 +28468,18 @@ YY_RULE_SETUP } YY_BREAK case 270: -#line 2281 "wcsbth.l" -+#line 2278 "wcsbth.l" ++#line 2243 "wcsbth.l" case 271: -#line 2282 "wcsbth.l" -+#line 2279 "wcsbth.l" ++#line 2244 "wcsbth.l" case 272: -#line 2283 "wcsbth.l" -+#line 2280 "wcsbth.l" ++#line 2245 "wcsbth.l" case 273: -#line 2284 "wcsbth.l" -+#line 2281 "wcsbth.l" ++#line 2246 "wcsbth.l" case 274: -#line 2285 "wcsbth.l" -+#line 2282 "wcsbth.l" ++#line 2247 "wcsbth.l" case 275: YY_RULE_SETUP -#line 2285 "wcsbth.l" -+#line 2282 "wcsbth.l" ++#line 2247 "wcsbth.l" { if (relax & WCSHDR_LONGKEY) { WCSBTH_PUTBACK; -@@ -28532,31 +28529,31 @@ YY_RULE_SETUP +@@ -28532,31 +28491,31 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6641,76 +7564,76 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c case 276: YY_RULE_SETUP -#line 2301 "wcsbth.l" -+#line 2298 "wcsbth.l" ++#line 2263 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 277: -#line 2306 "wcsbth.l" -+#line 2303 "wcsbth.l" ++#line 2268 "wcsbth.l" case 278: -#line 2307 "wcsbth.l" -+#line 2304 "wcsbth.l" ++#line 2269 "wcsbth.l" case 279: -#line 2308 "wcsbth.l" -+#line 2305 "wcsbth.l" ++#line 2270 "wcsbth.l" case 280: -#line 2309 "wcsbth.l" -+#line 2306 "wcsbth.l" ++#line 2271 "wcsbth.l" case 281: -#line 2310 "wcsbth.l" -+#line 2307 "wcsbth.l" ++#line 2272 "wcsbth.l" case 282: YY_RULE_SETUP -#line 2310 "wcsbth.l" -+#line 2307 "wcsbth.l" ++#line 2272 "wcsbth.l" { sscanf(yytext, "%d_%d%c", &n, &k, &a); i = wcsbth_colax(*wcs, &alts, n, a); -@@ -28566,14 +28563,14 @@ YY_RULE_SETUP +@@ -28566,14 +28525,14 @@ YY_RULE_SETUP } YY_BREAK case 283: -#line 2319 "wcsbth.l" -+#line 2316 "wcsbth.l" ++#line 2281 "wcsbth.l" case 284: -#line 2320 "wcsbth.l" -+#line 2317 "wcsbth.l" ++#line 2282 "wcsbth.l" case 285: -#line 2321 "wcsbth.l" -+#line 2318 "wcsbth.l" ++#line 2283 "wcsbth.l" case 286: YY_RULE_SETUP -#line 2321 "wcsbth.l" -+#line 2318 "wcsbth.l" ++#line 2283 "wcsbth.l" { sscanf(yytext, "%d_%d", &n, &k); a = ' '; -@@ -28585,18 +28582,18 @@ YY_RULE_SETUP +@@ -28585,18 +28544,18 @@ YY_RULE_SETUP YY_BREAK case 287: YY_RULE_SETUP -#line 2330 "wcsbth.l" -+#line 2327 "wcsbth.l" ++#line 2292 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 288: -#line 2335 "wcsbth.l" -+#line 2332 "wcsbth.l" ++#line 2297 "wcsbth.l" case 289: -#line 2336 "wcsbth.l" -+#line 2333 "wcsbth.l" ++#line 2298 "wcsbth.l" case 290: YY_RULE_SETUP -#line 2336 "wcsbth.l" -+#line 2333 "wcsbth.l" ++#line 2298 "wcsbth.l" { if (relax & WCSHDR_ALLIMG) { a = ' '; -@@ -28615,7 +28612,7 @@ YY_RULE_SETUP +@@ -28615,7 +28574,7 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6719,7 +7642,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c BEGIN(DISCARD); } -@@ -28626,51 +28623,51 @@ YY_RULE_SETUP +@@ -28626,51 +28585,51 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6732,7 +7655,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c case 291: YY_RULE_SETUP -#line 2370 "wcsbth.l" -+#line 2367 "wcsbth.l" ++#line 2332 "wcsbth.l" { if (relax & WCSHDR_ALLIMG) { yyless(0); @@ -6746,23 +7669,23 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 292: -#line 2381 "wcsbth.l" -+#line 2378 "wcsbth.l" ++#line 2343 "wcsbth.l" case 293: -#line 2382 "wcsbth.l" -+#line 2379 "wcsbth.l" ++#line 2344 "wcsbth.l" case 294: -#line 2383 "wcsbth.l" -+#line 2380 "wcsbth.l" ++#line 2345 "wcsbth.l" case 295: -#line 2384 "wcsbth.l" -+#line 2381 "wcsbth.l" ++#line 2346 "wcsbth.l" case 296: -#line 2385 "wcsbth.l" -+#line 2382 "wcsbth.l" ++#line 2347 "wcsbth.l" case 297: YY_RULE_SETUP -#line 2385 "wcsbth.l" -+#line 2382 "wcsbth.l" ++#line 2347 "wcsbth.l" { WCSBTH_PUTBACK; BEGIN((YY_START == iCROTn) ? iCCCna : TCCCna); @@ -6770,21 +7693,21 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 298: -#line 2391 "wcsbth.l" -+#line 2388 "wcsbth.l" ++#line 2353 "wcsbth.l" case 299: -#line 2392 "wcsbth.l" -+#line 2389 "wcsbth.l" ++#line 2354 "wcsbth.l" case 300: -#line 2393 "wcsbth.l" -+#line 2390 "wcsbth.l" ++#line 2355 "wcsbth.l" case 301: YY_RULE_SETUP -#line 2393 "wcsbth.l" -+#line 2390 "wcsbth.l" ++#line 2355 "wcsbth.l" { if (relax & WCSHDR_CROTAia) { WCSBTH_PUTBACK; -@@ -28683,27 +28680,27 @@ YY_RULE_SETUP +@@ -28683,27 +28642,27 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6796,29 +7719,29 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 302: -#line 2411 "wcsbth.l" -+#line 2408 "wcsbth.l" ++#line 2373 "wcsbth.l" case 303: YY_RULE_SETUP -#line 2411 "wcsbth.l" -+#line 2408 "wcsbth.l" ++#line 2373 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 304: -#line 2416 "wcsbth.l" -+#line 2413 "wcsbth.l" ++#line 2378 "wcsbth.l" case 305: YY_RULE_SETUP -#line 2416 "wcsbth.l" -+#line 2413 "wcsbth.l" ++#line 2378 "wcsbth.l" { - /* Image-header keyword. */ + // Image-header keyword. if (imherit || (relax & (WCSHDR_AUXIMG | WCSHDR_ALLIMG))) { if (YY_START == CCCCCCCa) { sscanf(yytext, "%c", &a); -@@ -28721,39 +28718,39 @@ YY_RULE_SETUP +@@ -28721,39 +28680,39 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6831,7 +7754,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c case 306: YY_RULE_SETUP -#line 2440 "wcsbth.l" -+#line 2437 "wcsbth.l" ++#line 2402 "wcsbth.l" { if (relax & WCSHDR_reject) { - /* Looks too much like a FITS WCS keyword not to flag it. */ @@ -6850,105 +7773,105 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 307: -#line 2455 "wcsbth.l" -+#line 2452 "wcsbth.l" ++#line 2417 "wcsbth.l" case 308: -#line 2456 "wcsbth.l" -+#line 2453 "wcsbth.l" ++#line 2418 "wcsbth.l" case 309: -#line 2457 "wcsbth.l" -+#line 2454 "wcsbth.l" ++#line 2419 "wcsbth.l" case 310: -#line 2458 "wcsbth.l" -+#line 2455 "wcsbth.l" ++#line 2420 "wcsbth.l" case 311: YY_RULE_SETUP -#line 2458 "wcsbth.l" -+#line 2455 "wcsbth.l" ++#line 2420 "wcsbth.l" { sscanf(yytext, "%d%c", &n, &a); keytype = BINTAB; -@@ -28762,7 +28759,7 @@ YY_RULE_SETUP +@@ -28762,7 +28721,7 @@ YY_RULE_SETUP YY_BREAK case 312: YY_RULE_SETUP -#line 2464 "wcsbth.l" -+#line 2461 "wcsbth.l" ++#line 2426 "wcsbth.l" { sscanf(yytext, "%d", &n); a = ' '; -@@ -28771,29 +28768,29 @@ YY_RULE_SETUP +@@ -28771,29 +28730,29 @@ YY_RULE_SETUP } YY_BREAK case 313: -#line 2472 "wcsbth.l" -+#line 2469 "wcsbth.l" ++#line 2434 "wcsbth.l" case 314: YY_RULE_SETUP -#line 2472 "wcsbth.l" -+#line 2469 "wcsbth.l" ++#line 2434 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 315: -#line 2477 "wcsbth.l" -+#line 2474 "wcsbth.l" ++#line 2439 "wcsbth.l" case 316: -#line 2478 "wcsbth.l" -+#line 2475 "wcsbth.l" ++#line 2440 "wcsbth.l" case 317: -#line 2479 "wcsbth.l" -+#line 2476 "wcsbth.l" ++#line 2441 "wcsbth.l" case 318: -#line 2480 "wcsbth.l" -+#line 2477 "wcsbth.l" ++#line 2442 "wcsbth.l" case 319: -#line 2481 "wcsbth.l" -+#line 2478 "wcsbth.l" ++#line 2443 "wcsbth.l" case 320: -#line 2482 "wcsbth.l" -+#line 2479 "wcsbth.l" ++#line 2444 "wcsbth.l" case 321: YY_RULE_SETUP -#line 2482 "wcsbth.l" -+#line 2479 "wcsbth.l" ++#line 2444 "wcsbth.l" { sscanf(yytext, "%d", &n); a = 0; -@@ -28802,25 +28799,25 @@ YY_RULE_SETUP +@@ -28802,25 +28761,25 @@ YY_RULE_SETUP } YY_BREAK case 322: -#line 2490 "wcsbth.l" -+#line 2487 "wcsbth.l" ++#line 2452 "wcsbth.l" case 323: YY_RULE_SETUP -#line 2490 "wcsbth.l" -+#line 2487 "wcsbth.l" ++#line 2452 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 324: -#line 2495 "wcsbth.l" -+#line 2492 "wcsbth.l" ++#line 2457 "wcsbth.l" case 325: -#line 2496 "wcsbth.l" -+#line 2493 "wcsbth.l" ++#line 2458 "wcsbth.l" case 326: -#line 2497 "wcsbth.l" -+#line 2494 "wcsbth.l" ++#line 2459 "wcsbth.l" case 327: YY_RULE_SETUP -#line 2497 "wcsbth.l" -+#line 2494 "wcsbth.l" ++#line 2459 "wcsbth.l" { - /* Image-header keyword. */ + // Image-header keyword. if (relax & WCSHDR_ALLIMG) { sscanf(yytext, "%d_%d%c", &i, &m, &a); keytype = IMGAXIS; -@@ -28833,54 +28830,54 @@ YY_RULE_SETUP +@@ -28833,54 +28792,54 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -6960,72 +7883,72 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 328: -#line 2517 "wcsbth.l" -+#line 2514 "wcsbth.l" ++#line 2479 "wcsbth.l" case 329: -#line 2518 "wcsbth.l" -+#line 2515 "wcsbth.l" ++#line 2480 "wcsbth.l" case 330: -#line 2519 "wcsbth.l" -+#line 2516 "wcsbth.l" ++#line 2481 "wcsbth.l" case 331: -#line 2520 "wcsbth.l" -+#line 2517 "wcsbth.l" ++#line 2482 "wcsbth.l" case 332: -#line 2521 "wcsbth.l" -+#line 2518 "wcsbth.l" ++#line 2483 "wcsbth.l" case 333: -#line 2522 "wcsbth.l" -+#line 2519 "wcsbth.l" ++#line 2484 "wcsbth.l" case 334: -#line 2523 "wcsbth.l" -+#line 2520 "wcsbth.l" ++#line 2485 "wcsbth.l" case 335: -#line 2524 "wcsbth.l" -+#line 2521 "wcsbth.l" ++#line 2486 "wcsbth.l" case 336: -#line 2525 "wcsbth.l" -+#line 2522 "wcsbth.l" ++#line 2487 "wcsbth.l" case 337: -#line 2526 "wcsbth.l" -+#line 2523 "wcsbth.l" ++#line 2488 "wcsbth.l" case 338: -#line 2527 "wcsbth.l" -+#line 2524 "wcsbth.l" ++#line 2489 "wcsbth.l" case 339: -#line 2528 "wcsbth.l" -+#line 2525 "wcsbth.l" ++#line 2490 "wcsbth.l" case 340: -#line 2529 "wcsbth.l" -+#line 2526 "wcsbth.l" ++#line 2491 "wcsbth.l" case 341: -#line 2530 "wcsbth.l" -+#line 2527 "wcsbth.l" ++#line 2492 "wcsbth.l" case 342: -#line 2531 "wcsbth.l" -+#line 2528 "wcsbth.l" ++#line 2493 "wcsbth.l" case 343: -#line 2532 "wcsbth.l" -+#line 2529 "wcsbth.l" ++#line 2494 "wcsbth.l" case 344: -#line 2533 "wcsbth.l" -+#line 2530 "wcsbth.l" ++#line 2495 "wcsbth.l" case 345: -#line 2534 "wcsbth.l" -+#line 2531 "wcsbth.l" ++#line 2496 "wcsbth.l" case 346: -#line 2535 "wcsbth.l" -+#line 2532 "wcsbth.l" ++#line 2497 "wcsbth.l" case 347: -#line 2536 "wcsbth.l" -+#line 2533 "wcsbth.l" ++#line 2498 "wcsbth.l" case 348: YY_RULE_SETUP -#line 2536 "wcsbth.l" -+#line 2533 "wcsbth.l" ++#line 2498 "wcsbth.l" { if (relax & WCSHDR_ALLIMG) { if (((valtype == FLOAT) && (relax & WCSHDR_PV0i_0ma)) || -@@ -28895,7 +28892,7 @@ YY_RULE_SETUP +@@ -28895,7 +28854,7 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -7034,7 +7957,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c BEGIN(DISCARD); } -@@ -28906,36 +28903,36 @@ YY_RULE_SETUP +@@ -28906,36 +28865,36 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -7046,35 +7969,35 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 349: -#line 2567 "wcsbth.l" -+#line 2564 "wcsbth.l" ++#line 2529 "wcsbth.l" case 350: -#line 2568 "wcsbth.l" -+#line 2565 "wcsbth.l" ++#line 2530 "wcsbth.l" case 351: -#line 2569 "wcsbth.l" -+#line 2566 "wcsbth.l" ++#line 2531 "wcsbth.l" case 352: -#line 2570 "wcsbth.l" -+#line 2567 "wcsbth.l" ++#line 2532 "wcsbth.l" case 353: -#line 2571 "wcsbth.l" -+#line 2568 "wcsbth.l" ++#line 2533 "wcsbth.l" case 354: -#line 2572 "wcsbth.l" -+#line 2569 "wcsbth.l" ++#line 2534 "wcsbth.l" case 355: -#line 2573 "wcsbth.l" -+#line 2570 "wcsbth.l" ++#line 2535 "wcsbth.l" case 356: -#line 2574 "wcsbth.l" -+#line 2571 "wcsbth.l" ++#line 2536 "wcsbth.l" case 357: -#line 2575 "wcsbth.l" -+#line 2572 "wcsbth.l" ++#line 2537 "wcsbth.l" case 358: YY_RULE_SETUP -#line 2575 "wcsbth.l" -+#line 2572 "wcsbth.l" ++#line 2537 "wcsbth.l" { if (relax & WCSHDR_ALLIMG) { - /* Anything that has fallen through to this point must contain */ @@ -7084,7 +8007,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c errmsg = "axis number must exceed 0"; BEGIN(ERROR); -@@ -28946,32 +28943,32 @@ YY_RULE_SETUP +@@ -28946,32 +28905,32 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -7096,89 +8019,89 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 359: -#line 2595 "wcsbth.l" -+#line 2592 "wcsbth.l" ++#line 2557 "wcsbth.l" case 360: -#line 2596 "wcsbth.l" -+#line 2593 "wcsbth.l" ++#line 2558 "wcsbth.l" case 361: -#line 2597 "wcsbth.l" -+#line 2594 "wcsbth.l" ++#line 2559 "wcsbth.l" case 362: -#line 2598 "wcsbth.l" -+#line 2595 "wcsbth.l" ++#line 2560 "wcsbth.l" case 363: -#line 2599 "wcsbth.l" -+#line 2596 "wcsbth.l" ++#line 2561 "wcsbth.l" case 364: -#line 2600 "wcsbth.l" -+#line 2597 "wcsbth.l" ++#line 2562 "wcsbth.l" case 365: -#line 2601 "wcsbth.l" -+#line 2598 "wcsbth.l" ++#line 2563 "wcsbth.l" case 366: -#line 2602 "wcsbth.l" -+#line 2599 "wcsbth.l" ++#line 2564 "wcsbth.l" case 367: -#line 2603 "wcsbth.l" -+#line 2600 "wcsbth.l" ++#line 2565 "wcsbth.l" case 368: YY_RULE_SETUP -#line 2603 "wcsbth.l" -+#line 2600 "wcsbth.l" ++#line 2565 "wcsbth.l" { errmsg = errtxt; sprintf(errmsg, "%s keyword must use an underscore, not a dash", -@@ -28981,36 +28978,36 @@ YY_RULE_SETUP +@@ -28981,36 +28940,36 @@ YY_RULE_SETUP YY_BREAK case 369: YY_RULE_SETUP -#line 2610 "wcsbth.l" -+#line 2607 "wcsbth.l" ++#line 2572 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 370: -#line 2615 "wcsbth.l" -+#line 2612 "wcsbth.l" ++#line 2577 "wcsbth.l" case 371: -#line 2616 "wcsbth.l" -+#line 2613 "wcsbth.l" ++#line 2578 "wcsbth.l" case 372: -#line 2617 "wcsbth.l" -+#line 2614 "wcsbth.l" ++#line 2579 "wcsbth.l" case 373: -#line 2618 "wcsbth.l" -+#line 2615 "wcsbth.l" ++#line 2580 "wcsbth.l" case 374: -#line 2619 "wcsbth.l" -+#line 2616 "wcsbth.l" ++#line 2581 "wcsbth.l" case 375: -#line 2620 "wcsbth.l" -+#line 2617 "wcsbth.l" ++#line 2582 "wcsbth.l" case 376: -#line 2621 "wcsbth.l" -+#line 2618 "wcsbth.l" ++#line 2583 "wcsbth.l" case 377: -#line 2622 "wcsbth.l" -+#line 2619 "wcsbth.l" ++#line 2584 "wcsbth.l" case 378: -#line 2623 "wcsbth.l" -+#line 2620 "wcsbth.l" ++#line 2585 "wcsbth.l" case 379: -#line 2624 "wcsbth.l" -+#line 2621 "wcsbth.l" ++#line 2586 "wcsbth.l" case 380: -#line 2625 "wcsbth.l" -+#line 2622 "wcsbth.l" ++#line 2587 "wcsbth.l" case 381: YY_RULE_SETUP -#line 2625 "wcsbth.l" -+#line 2622 "wcsbth.l" ++#line 2587 "wcsbth.l" { if (relax & WCSHDR_LONGKEY) { WCSBTH_PUTBACK; -@@ -29022,45 +29019,45 @@ YY_RULE_SETUP +@@ -29022,45 +28981,45 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -7190,99 +8113,99 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 382: -#line 2642 "wcsbth.l" -+#line 2639 "wcsbth.l" ++#line 2604 "wcsbth.l" case 383: YY_RULE_SETUP -#line 2642 "wcsbth.l" -+#line 2639 "wcsbth.l" ++#line 2604 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 384: -#line 2647 "wcsbth.l" -+#line 2644 "wcsbth.l" ++#line 2609 "wcsbth.l" case 385: -#line 2648 "wcsbth.l" -+#line 2645 "wcsbth.l" ++#line 2610 "wcsbth.l" case 386: -#line 2649 "wcsbth.l" -+#line 2646 "wcsbth.l" ++#line 2611 "wcsbth.l" case 387: -#line 2650 "wcsbth.l" -+#line 2647 "wcsbth.l" ++#line 2612 "wcsbth.l" case 388: -#line 2651 "wcsbth.l" -+#line 2648 "wcsbth.l" ++#line 2613 "wcsbth.l" case 389: -#line 2652 "wcsbth.l" -+#line 2649 "wcsbth.l" ++#line 2614 "wcsbth.l" case 390: -#line 2653 "wcsbth.l" -+#line 2650 "wcsbth.l" ++#line 2615 "wcsbth.l" case 391: -#line 2654 "wcsbth.l" -+#line 2651 "wcsbth.l" ++#line 2616 "wcsbth.l" case 392: -#line 2655 "wcsbth.l" -+#line 2652 "wcsbth.l" ++#line 2617 "wcsbth.l" case 393: -#line 2656 "wcsbth.l" -+#line 2653 "wcsbth.l" ++#line 2618 "wcsbth.l" case 394: -#line 2657 "wcsbth.l" -+#line 2654 "wcsbth.l" ++#line 2619 "wcsbth.l" case 395: YY_RULE_SETUP -#line 2657 "wcsbth.l" -+#line 2654 "wcsbth.l" ++#line 2619 "wcsbth.l" { sscanf(yytext, "%d_%d%c", &n, &m, &a); if (YY_START == TCn_ma) i = wcsbth_colax(*wcs, &alts, n, a); -@@ -29069,24 +29066,24 @@ YY_RULE_SETUP +@@ -29069,24 +29028,24 @@ YY_RULE_SETUP } YY_BREAK case 396: -#line 2665 "wcsbth.l" -+#line 2662 "wcsbth.l" ++#line 2627 "wcsbth.l" case 397: -#line 2666 "wcsbth.l" -+#line 2663 "wcsbth.l" ++#line 2628 "wcsbth.l" case 398: -#line 2667 "wcsbth.l" -+#line 2664 "wcsbth.l" ++#line 2629 "wcsbth.l" case 399: -#line 2668 "wcsbth.l" -+#line 2665 "wcsbth.l" ++#line 2630 "wcsbth.l" case 400: -#line 2669 "wcsbth.l" -+#line 2666 "wcsbth.l" ++#line 2631 "wcsbth.l" case 401: -#line 2670 "wcsbth.l" -+#line 2667 "wcsbth.l" ++#line 2632 "wcsbth.l" case 402: -#line 2671 "wcsbth.l" -+#line 2668 "wcsbth.l" ++#line 2633 "wcsbth.l" case 403: YY_RULE_SETUP -#line 2671 "wcsbth.l" -+#line 2668 "wcsbth.l" ++#line 2633 "wcsbth.l" { - /* Invalid combinations will be flagged by . */ + // Invalid combinations will be flagged by . sscanf(yytext, "%d_%d", &n, &m); a = ' '; if (YY_START == TCn_ma) i = wcsbth_colax(*wcs, &alts, n, a); -@@ -29095,17 +29092,17 @@ YY_RULE_SETUP +@@ -29095,17 +29054,17 @@ YY_RULE_SETUP } YY_BREAK case 404: -#line 2681 "wcsbth.l" -+#line 2678 "wcsbth.l" ++#line 2643 "wcsbth.l" case 405: YY_RULE_SETUP -#line 2681 "wcsbth.l" -+#line 2678 "wcsbth.l" ++#line 2643 "wcsbth.l" { BEGIN(DISCARD); } @@ -7290,11 +8213,11 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c case 406: YY_RULE_SETUP -#line 2685 "wcsbth.l" -+#line 2682 "wcsbth.l" ++#line 2647 "wcsbth.l" { if (relax & WCSHDR_PROJPn) { sscanf(yytext, "%d", &m); -@@ -29119,16 +29116,16 @@ YY_RULE_SETUP +@@ -29119,16 +29078,16 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -7306,20 +8229,20 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c YY_BREAK case 407: -#line 2704 "wcsbth.l" -+#line 2701 "wcsbth.l" ++#line 2666 "wcsbth.l" case 408: YY_RULE_SETUP -#line 2704 "wcsbth.l" -+#line 2701 "wcsbth.l" ++#line 2666 "wcsbth.l" { if (relax & (WCSHDR_PROJPn | WCSHDR_reject)) { errmsg = "invalid PROJPn keyword"; -@@ -29141,25 +29138,25 @@ YY_RULE_SETUP +@@ -29141,26 +29100,26 @@ YY_RULE_SETUP YY_BREAK case 409: YY_RULE_SETUP -#line 2714 "wcsbth.l" -+#line 2711 "wcsbth.l" ++#line 2676 "wcsbth.l" { BEGIN(DISCARD); } @@ -7327,7 +8250,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c case 410: YY_RULE_SETUP -#line 2718 "wcsbth.l" -+#line 2715 "wcsbth.l" ++#line 2680 "wcsbth.l" { - /* Do checks on i, j, m, n, k. */ + // Do checks on i, j, m, n, k. @@ -7342,12 +8265,14 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c if (k && (exclude[n] != exclude[k])) { - /* For keywords such as TCn_ka, both columns must be excluded. - User error, so return immediately. */ +- return 3; + // For keywords such as TCn_ka, both columns must be excluded. + // User error, so return immediately. - return 3; ++ return WCSHDRERR_BAD_COLUMN; } else { -@@ -29179,18 +29176,18 @@ YY_RULE_SETUP + BEGIN(DISCARD); +@@ -29179,18 +29138,18 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -7370,21 +8295,21 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c vptr = 0x0; } -@@ -29213,7 +29210,7 @@ YY_RULE_SETUP +@@ -29213,7 +29172,7 @@ YY_RULE_SETUP YY_BREAK case 411: YY_RULE_SETUP -#line 2780 "wcsbth.l" -+#line 2777 "wcsbth.l" ++#line 2742 "wcsbth.l" { errmsg = "invalid KEYWORD = VALUE syntax"; BEGIN(ERROR); -@@ -29221,13 +29218,13 @@ YY_RULE_SETUP +@@ -29221,13 +29180,13 @@ YY_RULE_SETUP YY_BREAK case 412: YY_RULE_SETUP -#line 2785 "wcsbth.l" -+#line 2782 "wcsbth.l" ++#line 2747 "wcsbth.l" { if (ipass == 1) { BEGIN(COMMENT); @@ -7395,21 +8320,21 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c sscanf(yytext, "%d", &inttmp); BEGIN(COMMENT); -@@ -29236,7 +29233,7 @@ YY_RULE_SETUP +@@ -29236,7 +29195,7 @@ YY_RULE_SETUP YY_BREAK case 413: YY_RULE_SETUP -#line 2797 "wcsbth.l" -+#line 2794 "wcsbth.l" ++#line 2759 "wcsbth.l" { errmsg = "an integer value was expected"; BEGIN(ERROR); -@@ -29244,13 +29241,13 @@ YY_RULE_SETUP +@@ -29244,13 +29203,13 @@ YY_RULE_SETUP YY_BREAK case 414: YY_RULE_SETUP -#line 2802 "wcsbth.l" -+#line 2799 "wcsbth.l" ++#line 2764 "wcsbth.l" { if (ipass == 1) { BEGIN(COMMENT); @@ -7420,21 +8345,21 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c wcsutil_str2double(yytext, &dbltmp); if (chekval && chekval(dbltmp)) { -@@ -29264,7 +29261,7 @@ YY_RULE_SETUP +@@ -29264,7 +29223,7 @@ YY_RULE_SETUP YY_BREAK case 415: YY_RULE_SETUP -#line 2819 "wcsbth.l" -+#line 2816 "wcsbth.l" ++#line 2781 "wcsbth.l" { errmsg = "a floating-point value was expected"; BEGIN(ERROR); -@@ -29272,13 +29269,13 @@ YY_RULE_SETUP +@@ -29272,13 +29231,13 @@ YY_RULE_SETUP YY_BREAK case 416: YY_RULE_SETUP -#line 2824 "wcsbth.l" -+#line 2821 "wcsbth.l" ++#line 2786 "wcsbth.l" { if (ipass == 1) { BEGIN(COMMENT); @@ -7445,50 +8370,55 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c wcsutil_str2double2(yytext, dbl2tmp); BEGIN(COMMENT); -@@ -29287,7 +29284,7 @@ YY_RULE_SETUP +@@ -29287,7 +29246,7 @@ YY_RULE_SETUP YY_BREAK case 417: YY_RULE_SETUP -#line 2836 "wcsbth.l" -+#line 2833 "wcsbth.l" ++#line 2798 "wcsbth.l" { errmsg = "a floating-point value was expected"; BEGIN(ERROR); -@@ -29296,16 +29293,16 @@ YY_RULE_SETUP +@@ -29296,18 +29255,18 @@ YY_RULE_SETUP case 418: /* rule 418 can match eol */ YY_RULE_SETUP -#line 2841 "wcsbth.l" -+#line 2838 "wcsbth.l" ++#line 2803 "wcsbth.l" { if (ipass == 1) { BEGIN(COMMENT); } else { - /* Read the keyvalue. */ +- strcpy(strtmp, yytext+1); + // Read the keyvalue. - strcpy(strtmp, yytext+1); ++ strcpy(strtmp, yytext+1); - /* Squeeze out repeated quotes. */ +- ix = 0; +- for (jx = 0; jx < 72; jx++) { + // Squeeze out repeated quotes. - ix = 0; - for (jx = 0; jx < 72; jx++) { ++ int ix = 0; ++ for (int jx = 0; jx < 72; jx++) { if (ix < jx) { -@@ -29328,7 +29325,7 @@ YY_RULE_SETUP + strtmp[ix] = strtmp[jx]; + } +@@ -29328,7 +29287,7 @@ YY_RULE_SETUP YY_BREAK case 419: YY_RULE_SETUP -#line 2870 "wcsbth.l" -+#line 2867 "wcsbth.l" ++#line 2832 "wcsbth.l" { errmsg = "a string value was expected"; BEGIN(ERROR); -@@ -29339,31 +29336,31 @@ case 420: +@@ -29339,32 +29298,34 @@ case 420: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 2875 "wcsbth.l" -+#line 2872 "wcsbth.l" ++#line 2837 "wcsbth.l" { if (ipass == 1) { - /* Do first-pass bookkeeping. */ @@ -7503,34 +8433,43 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c alts.ialt = 0; - /* Update each coordinate representation. */ +- gotone = 0; + // Update each coordinate representation. - gotone = 0; ++ int gotone = 0; ++ struct wcsprm *wcsp; while ((wcsp = wcsbth_idx(*wcs, &alts, keytype, n, a))) { gotone = 1; if (vptr) { ++ void *wptr; if (auxprm) { - /* Additional auxiliary parameter. */ + // Additional auxiliary parameter. auxp = wcsp->aux; - voff = (char *)vptr - (char *)(&auxtem); +- voff = (char *)vptr - (char *)(&auxtem); ++ ptrdiff_t voff = (char *)vptr - (char *)(&auxtem); wptr = (void *)((char *)auxp + voff); } else { - /* A parameter that lives directly in wcsprm. */ +- voff = (char *)vptr - (char *)(&wcstem); + // A parameter that lives directly in wcsprm. - voff = (char *)vptr - (char *)(&wcstem); ++ ptrdiff_t voff = (char *)vptr - (char *)(&wcstem); wptr = (void *)((char *)wcsp + voff); } -@@ -29372,7 +29369,7 @@ YY_RULE_SETUP + +@@ -29372,9 +29333,9 @@ YY_RULE_SETUP *((int *)wptr) = inttmp; } else if (valtype == FLOAT) { - /* Apply keyword parameterization. */ + // Apply keyword parameterization. if (ptype == 'v') { - ipx = (wcsp->npv)++; +- ipx = (wcsp->npv)++; ++ int ipx = (wcsp->npv)++; wcsp->pv[ipx].i = i; -@@ -29393,14 +29390,14 @@ YY_RULE_SETUP + wcsp->pv[ipx].m = m; + wptr = &(wcsp->pv[ipx].value); +@@ -29393,14 +29354,14 @@ YY_RULE_SETUP *((double *)wptr) = dbltmp; } @@ -7547,57 +8486,69 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c if (special) { special(wptr, dbl2tmp); } else { -@@ -29409,7 +29406,7 @@ YY_RULE_SETUP +@@ -29409,9 +29370,9 @@ YY_RULE_SETUP } } else if (valtype == STRING) { - /* Apply keyword parameterization. */ + // Apply keyword parameterization. if (ptype == 's') { - ipx = wcsp->nps++; +- ipx = wcsp->nps++; ++ int ipx = wcsp->nps++; wcsp->ps[ipx].i = i; -@@ -29460,7 +29457,7 @@ case 421: + wcsp->ps[ipx].m = m; + wptr = wcsp->ps[ipx].value; +@@ -29424,7 +29385,7 @@ YY_RULE_SETUP + wptr = *((char (**)[72])wptr) + (i - 1); + } + +- cptr = (char *)wptr; ++ char *cptr = (char *)wptr; + strcpy(cptr, strtmp); + } + } +@@ -29460,7 +29421,7 @@ case 421: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 2990 "wcsbth.l" -+#line 2987 "wcsbth.l" ++#line 2954 "wcsbth.l" { errmsg = "invalid keyvalue"; BEGIN(ERROR); -@@ -29471,7 +29468,7 @@ case 422: +@@ -29471,7 +29432,7 @@ case 422: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 2995 "wcsbth.l" -+#line 2992 "wcsbth.l" ++#line 2959 "wcsbth.l" { errmsg = "invalid keyvalue"; BEGIN(ERROR); -@@ -29482,7 +29479,7 @@ case 423: +@@ -29482,7 +29443,7 @@ case 423: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 3000 "wcsbth.l" -+#line 2997 "wcsbth.l" ++#line 2964 "wcsbth.l" { errmsg = "invalid keyvalue or malformed keycomment"; BEGIN(ERROR); -@@ -29493,7 +29490,7 @@ case 424: +@@ -29493,7 +29454,7 @@ case 424: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 3005 "wcsbth.l" -+#line 3002 "wcsbth.l" ++#line 2969 "wcsbth.l" { errmsg = "malformed keycomment"; BEGIN(ERROR); -@@ -29504,11 +29501,11 @@ case 425: +@@ -29504,11 +29465,11 @@ case 425: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 3010 "wcsbth.l" -+#line 3007 "wcsbth.l" ++#line 2974 "wcsbth.l" { if (ipass == npass) { if (ctrl < 0) { @@ -7606,25 +8557,25 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c keep = keyrec; } else if (2 < ctrl) { -@@ -29525,7 +29522,7 @@ case 426: +@@ -29525,7 +29486,7 @@ case 426: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 3025 "wcsbth.l" -+#line 3022 "wcsbth.l" ++#line 2989 "wcsbth.l" { if (ipass == npass) { (*nreject)++; -@@ -29545,7 +29542,7 @@ YY_RULE_SETUP +@@ -29545,7 +29506,7 @@ YY_RULE_SETUP case 427: /* rule 427 can match eol */ YY_RULE_SETUP -#line 3041 "wcsbth.l" -+#line 3038 "wcsbth.l" ++#line 3005 "wcsbth.l" { if (ipass == npass && keep) { if (hptr < keep) { -@@ -29556,7 +29553,7 @@ YY_RULE_SETUP +@@ -29556,7 +29517,7 @@ YY_RULE_SETUP naux += auxprm; @@ -7633,50 +8584,98 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c i = j = 0; n = k = 0; m = 0; -@@ -29611,9 +29608,9 @@ case YY_STATE_EOF(COMMENT): +@@ -29611,10 +29572,11 @@ case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(DISCARD): case YY_STATE_EOF(ERROR): case YY_STATE_EOF(FLUSH): -#line 3072 "wcsbth.l" -+#line 3069 "wcsbth.l" ++#line 3036 "wcsbth.l" { - /* End-of-input. */ + // End-of-input. if (ipass == 1) { ++ int status; if ((status = wcsbth_init1(&alts, naux, nwcs, wcs)) || (*nwcs == 0 && ctrl == 0)) { -@@ -29682,10 +29679,10 @@ case YY_STATE_EOF(FLUSH): + return status; +@@ -29635,8 +29597,8 @@ case YY_STATE_EOF(FLUSH): + } + + if (ipass++ < npass) { +- wcsbth_hdr = header; +- wcsbth_nkeyrec = nkeyrec; ++ yyextra->hdr = header; ++ yyextra->nkeyrec = nkeyrec; + keyrec = header; + *nreject = 0; + +@@ -29682,10 +29644,10 @@ case YY_STATE_EOF(FLUSH): YY_BREAK case 428: YY_RULE_SETUP -#line 3140 "wcsbth.l" -+#line 3137 "wcsbth.l" ++#line 3105 "wcsbth.l" ECHO; YY_BREAK -#line 29689 "wcsbth.c" -+#line 29686 "wcsbth.c" ++#line 29651 "wcsbth.c" case YY_END_OF_BUFFER: { -@@ -30850,7 +30847,7 @@ void yyfree (void * ptr , yyscan_t yysca +@@ -30850,8 +30812,38 @@ void yyfree (void * ptr , yyscan_t yysca #define YYTABLES_NAME "yytables" -#line 3140 "wcsbth.l" -+#line 3137 "wcsbth.l" ++#line 3105 "wcsbth.l" ++ ++ ++/*---------------------------------------------------------------------------- ++* External interface to the scanner. ++*---------------------------------------------------------------------------*/ ++ ++int wcsbth( ++ char *header, ++ int nkeyrec, ++ int relax, ++ int ctrl, ++ int keysel, ++ int *colsel, ++ int *nreject, ++ int *nwcs, ++ struct wcsprm **wcs) ++ ++{ ++ // Function prototypes. ++ int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner); ++ int yylex_destroy(yyscan_t yyscanner); ++ ++ struct wcsbth_extra extra; ++ yyscan_t yyscanner; ++ yylex_init_extra(&extra, &yyscanner); ++ int status = wcsbth_scanner(header, nkeyrec, relax, ctrl, keysel, colsel, ++ nreject, nwcs, wcs, yyscanner); ++ yylex_destroy(yyscanner); ++ return status; ++} /*---------------------------------------------------------------------------- -@@ -30893,20 +30890,20 @@ int wcsbth_pass1( - int ialt, icol, mask, ncol; + * Perform first-pass tasks: +@@ -30890,23 +30882,21 @@ int wcsbth_pass1( + struct wcsbth_alts *alts) + { +- int ialt, icol, mask, ncol; +- if (a == 0) { - /* Keywords such as DATE-OBS go along for the ride. */ + // Keywords such as DATE-OBS go along for the ride. return 0; } - ncol = alts->ncol; +- ncol = alts->ncol; ++ int ncol = alts->ncol; - /* Do we need to allocate memory for alts? */ + // Do we need to allocate memory for alts? @@ -7694,7 +8693,14 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c ncol = 999; } } -@@ -30925,7 +30922,7 @@ int wcsbth_pass1( +@@ -30919,13 +30909,13 @@ int wcsbth_pass1( + if (alts->npv) free(alts->npv); + if (alts->nps) free(alts->nps); + if (alts->pixlist) free(alts->pixlist); +- return 2; ++ return WCSHDRERR_MEMORY; + } + alts->ncol = ncol; } else if (n > ncol || k > ncol) { @@ -7703,16 +8709,30 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c ncol = 999; if (!(alts->arridx = realloc(alts->arridx, 27*(1 + ncol)*sizeof(short int))) || -@@ -30942,7 +30939,7 @@ int wcsbth_pass1( - return 2; +@@ -30939,12 +30929,12 @@ int wcsbth_pass1( + if (alts->npv) free(alts->npv); + if (alts->nps) free(alts->nps); + if (alts->pixlist) free(alts->pixlist); +- return 2; ++ return WCSHDRERR_MEMORY; } - /* Since realloc() doesn't initialize the extra memory. */ +- for (icol = (1 + alts->ncol); icol < (1 + ncol); icol++) { +- for (ialt = 0; ialt < 27; ialt++) { + // Since realloc() doesn't initialize the extra memory. - for (icol = (1 + alts->ncol); icol < (1 + ncol); icol++) { - for (ialt = 0; ialt < 27; ialt++) { ++ for (int icol = (1 + alts->ncol); icol < (1 + ncol); icol++) { ++ for (int ialt = 0; ialt < 27; ialt++) { alts->arridx[icol][ialt] = 0; -@@ -30960,18 +30957,18 @@ int wcsbth_pass1( + alts->npv[icol][ialt] = 0; + alts->nps[icol][ialt] = 0; +@@ -30955,23 +30945,23 @@ int wcsbth_pass1( + alts->ncol = ncol; + } + +- ialt = 0; ++ int ialt = 0; + if (a != ' ') { ialt = a - 'A' + 1; } @@ -7736,7 +8756,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c if (alts->arridx[n][ialt] < i) { alts->arridx[n][ialt] = i; } -@@ -30988,17 +30985,17 @@ int wcsbth_pass1( +@@ -30988,17 +30978,17 @@ int wcsbth_pass1( } } @@ -7747,7 +8767,8 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c + // image arrays, never contribute to recognizing a table column as a pixel + // list axis. A PIXLIST keytype is required for that. if (keytype == PIXLIST) { - mask = 1 << ialt; +- mask = 1 << ialt; ++ int mask = 1 << ialt; - /* n > 0 for PIXLIST keytypes. */ + // n > 0 for PIXLIST keytypes. @@ -7759,16 +8780,34 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c alts->pixlist[0] |= mask; if (ptype == 'v') { -@@ -31035,7 +31032,7 @@ int wcsbth_init1( +@@ -31026,22 +31016,20 @@ int wcsbth_init1( + struct wcsprm **wcs) + + { +- int ialt, icol, inherit[27], ix, mask, ncol, npsmax, npvmax, status = 0; +- struct wcsprm *wcsp; +- ++ int status = 0; + + if (alts->arridx == 0x0) { + *nwcs = 0; return 0; } - /* Determine the number of axes in each pixel list representation. */ +- ncol = alts->ncol; + // Determine the number of axes in each pixel list representation. - ncol = alts->ncol; ++ int ialt, mask, ncol = alts->ncol; for (ialt = 0, mask = 1; ialt < 27; ialt++, mask <<= 1) { alts->pixidx[ialt] = 0; -@@ -31049,7 +31046,7 @@ int wcsbth_init1( + + if (alts->pixlist[0] | mask) { +- for (icol = 1; icol <= ncol; icol++) { ++ for (int icol = 1; icol <= ncol; icol++) { + if (alts->pixlist[icol] & mask) { + alts->pixidx[ialt]++; + } +@@ -31049,18 +31037,19 @@ int wcsbth_init1( } } @@ -7776,10 +8815,13 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c + // Find the total number of coordinate representations. *nwcs = 0; alts->imgherit = 0; - for (ialt = 0; ialt < 27; ialt++) { -@@ -31057,10 +31054,10 @@ int wcsbth_init1( +- for (ialt = 0; ialt < 27; ialt++) { ++ int inherit[27]; ++ for (int ialt = 0; ialt < 27; ialt++) { + inherit[ialt] = 0; - for (icol = 1; icol <= ncol; icol++) { +- for (icol = 1; icol <= ncol; icol++) { ++ for (int icol = 1; icol <= ncol; icol++) { if (alts->arridx[icol][ialt] < 0) { - /* No BIMGARR keytype but there's at least one BINTAB. */ + // No BIMGARR keytype but there's at least one BINTAB. @@ -7791,7 +8833,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c alts->arridx[icol][ialt] = alts->arridx[0][ialt]; } else { alts->arridx[icol][ialt] = 0; -@@ -31069,11 +31066,11 @@ int wcsbth_init1( +@@ -31069,11 +31058,11 @@ int wcsbth_init1( if (alts->arridx[icol][ialt]) { if (alts->arridx[0][ialt]) { @@ -7805,7 +8847,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c alts->arridx[icol][ialt] = alts->arridx[0][ialt]; } } -@@ -31082,10 +31079,10 @@ int wcsbth_init1( +@@ -31082,10 +31071,10 @@ int wcsbth_init1( } } @@ -7818,7 +8860,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c alts->arridx[0][ialt] = 0; alts->imgherit = 1; } else if (alts->arridx[0][ialt] > 0) { -@@ -31093,7 +31090,7 @@ int wcsbth_init1( +@@ -31093,7 +31082,7 @@ int wcsbth_init1( } } @@ -7827,31 +8869,39 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c if (alts->pixidx[ialt]) { (*nwcs)++; } -@@ -31101,19 +31098,19 @@ int wcsbth_init1( +@@ -31101,95 +31090,95 @@ int wcsbth_init1( if (*nwcs) { - /* Allocate memory for the required number of wcsprm structs. */ + // Allocate memory for the required number of wcsprm structs. if (!(*wcs = calloc(*nwcs, sizeof(struct wcsprm)))) { - return 2; +- return 2; ++ return WCSHDRERR_MEMORY; } - /* Initialize each wcsprm struct. */ +- wcsp = *wcs; + // Initialize each wcsprm struct. - wcsp = *wcs; ++ struct wcsprm *wcsp = *wcs; *nwcs = 0; - for (icol = 0; icol <= ncol; icol++) { - for (ialt = 0; ialt < 27; ialt++) { +- for (icol = 0; icol <= ncol; icol++) { +- for (ialt = 0; ialt < 27; ialt++) { ++ for (int icol = 0; icol <= ncol; icol++) { ++ for (int ialt = 0; ialt < 27; ialt++) { if (alts->arridx[icol][ialt] > 0) { - /* Image-header representations that are not for inheritance - (icol == 0) or binary table image array representations. */ + // Image-header representations that are not for inheritance + // (icol == 0) or binary table image array representations. wcsp->flag = -1; - npvmax = alts->npv[icol][ialt]; - npsmax = alts->nps[icol][ialt]; -@@ -31123,29 +31120,29 @@ int wcsbth_init1( +- npvmax = alts->npv[icol][ialt]; +- npsmax = alts->nps[icol][ialt]; ++ int npvmax = alts->npv[icol][ialt]; ++ int npsmax = alts->nps[icol][ialt]; + if ((status = wcsinit(1, (int)(alts->arridx[icol][ialt]), wcsp, + npvmax, npsmax, -1))) { + wcsvfree(nwcs, wcs); break; } @@ -7887,16 +8937,21 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c alts->arridx[icol][ialt] = -1; } } -@@ -31153,7 +31150,7 @@ int wcsbth_init1( + } - for (ialt = 0; ialt < 27; ialt++) { +- for (ialt = 0; ialt < 27; ialt++) { ++ for (int ialt = 0; ialt < 27; ialt++) { if (alts->pixidx[ialt]) { - /* Pixel lists representations. */ + // Pixel lists representations. wcsp->flag = -1; - npvmax = alts->pixnpv[ialt]; - npsmax = alts->pixnps[ialt]; -@@ -31163,19 +31160,19 @@ int wcsbth_init1( +- npvmax = alts->pixnpv[ialt]; +- npsmax = alts->pixnps[ialt]; ++ int npvmax = alts->pixnpv[ialt]; ++ int npsmax = alts->pixnps[ialt]; + if ((status = wcsinit(1, (int)(alts->pixidx[ialt]), wcsp, npvmax, + npsmax, -1))) { + wcsvfree(nwcs, wcs); break; } @@ -7915,11 +8970,12 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c } - /* Record the pixel list column numbers. */ +- mask = (1 << ialt); + // Record the pixel list column numbers. - mask = (1 << ialt); ++ int icol, ix, mask = (1 << ialt); for (icol = 1, ix = 0; icol <= ncol; icol++) { if (alts->pixlist[icol] & mask) { -@@ -31183,13 +31180,13 @@ int wcsbth_init1( + wcsp->colax[ix++] = icol; } } @@ -7935,9 +8991,16 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c alts->pixidx[ialt] = -1; } } -@@ -31219,22 +31216,22 @@ struct wcsprm *wcsbth_idx( +@@ -31213,28 +31202,27 @@ struct wcsprm *wcsbth_idx( - iwcs = -1; + { + const char as[] = " ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +- int iwcs; + + if (!wcs) return 0x0; + +- iwcs = -1; ++ int iwcs = -1; for (; iwcs < 0 && alts->ialt < 27; alts->ialt++) { - /* Note that a == 0 applies to every alternate, otherwise this - loop simply determines the appropriate value of alts->ialt. */ @@ -7964,7 +9027,27 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c alts->icol = 0; } -@@ -31286,7 +31283,7 @@ int wcsbth_colax( +@@ -31259,17 +31247,14 @@ int wcsbth_colax( + char a) + + { +- int ix; +- struct wcsprm *wcsp; +- + if (!wcs) return 0; + +- wcsp = wcs; ++ struct wcsprm *wcsp = wcs; + if (a != ' ') { + wcsp += alts->pixidx[a-'A'+1]; + } + +- for (ix = 0; ix < wcsp->naxis; ix++) { ++ for (int ix = 0; ix < wcsp->naxis; ix++) { + if (wcsp->colax[ix] == n) { + return ++ix; + } +@@ -31286,7 +31271,7 @@ int wcsbth_colax( int wcsbth_jdref(double *mjdref, const double *jdref) { @@ -7973,7 +9056,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c if (undefined(mjdref[0] && undefined(mjdref[1]))) { mjdref[0] = jdref[0] - 2400000.0; mjdref[1] = jdref[1] - 0.5; -@@ -31303,7 +31300,7 @@ int wcsbth_jdref(double *mjdref, const d +@@ -31303,7 +31288,7 @@ int wcsbth_jdref(double *mjdref, const d int wcsbth_jdrefi(double *mjdref, const double *jdrefi) { @@ -7982,7 +9065,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c if (undefined(mjdref[0])) { mjdref[0] = *jdrefi - 2400000.5; } -@@ -31315,7 +31312,7 @@ int wcsbth_jdrefi(double *mjdref, const +@@ -31315,7 +31300,7 @@ int wcsbth_jdrefi(double *mjdref, const int wcsbth_jdreff(double *mjdref, const double *jdreff) { @@ -7991,7 +9074,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c if (undefined(mjdref[1])) { mjdref[1] = *jdreff; } -@@ -31331,7 +31328,7 @@ int wcsbth_jdreff(double *mjdref, const +@@ -31331,7 +31316,7 @@ int wcsbth_jdreff(double *mjdref, const int wcsbth_epoch(double *equinox, const double *epoch) { @@ -8000,31 +9083,46 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsbth.c if (undefined(*equinox)) { *equinox = *epoch; } -@@ -31349,9 +31346,9 @@ int wcsbth_vsource(double *zsource, cons +@@ -31347,12 +31332,12 @@ int wcsbth_epoch(double *equinox, const + int wcsbth_vsource(double *zsource, const double *vsource) + { - double beta, c = 299792458.0; +- double beta, c = 299792458.0; ++ const double c = 299792458.0; - /* If ZSOURCEa is currently undefined then set it from VSOURCEa. */ + // If ZSOURCEa is currently undefined then set it from VSOURCEa. if (undefined(*zsource)) { - /* Convert relativistic Doppler velocity to redshift. */ +- beta = *vsource/c; + // Convert relativistic Doppler velocity to redshift. - beta = *vsource/c; ++ double beta = *vsource/c; *zsource = (1.0 + beta)/sqrt(1.0 - beta*beta) - 1.0; } -@@ -31389,7 +31386,7 @@ int wcsbth_final( + +@@ -31381,15 +31366,14 @@ int wcsbth_final( + struct wcsprm **wcs) + + { +- int ialt, status; +- + if (alts->arridx) free(alts->arridx); + if (alts->npv) free(alts->npv); + if (alts->nps) free(alts->nps); if (alts->pixlist) free(alts->pixlist); - for (ialt = 0; ialt < *nwcs; ialt++) { +- for (ialt = 0; ialt < *nwcs; ialt++) { - /* Interpret -TAB header keywords. */ ++ for (int ialt = 0; ialt < *nwcs; ialt++) { + // Interpret -TAB header keywords. ++ int status; if ((status = wcstab(*wcs+ialt))) { wcsvfree(nwcs, wcs); return status; -Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c +Index: astropy-4.2.1/cextern/wcslib/C/flexed/wcspih.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/flexed/wcspih.c -+++ astropy-4.2/cextern/wcslib/C/flexed/wcspih.c +--- astropy-4.2.1.orig/cextern/wcslib/C/flexed/wcspih.c ++++ astropy-4.2.1/cextern/wcslib/C/flexed/wcspih.c @@ -20763,9 +20763,8 @@ static const yy_state_type yy_NUL_trans[ #define YY_RESTORE_YY_MORE_OFFSET #line 1 "wcspih.l" @@ -8032,7 +9130,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -8046,7 +9144,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcspih.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcspih.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcspih.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * * wcspih.l is a Flex description file containing the definition of a lexical @@ -8055,117 +9153,228 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c -#line 112 "wcspih.l" -+#line 109 "wcspih.l" ++#line 110 "wcspih.l" #include #include #include -@@ -20874,7 +20871,7 @@ static int wcspih_scanner(char *header, - int *nreject, int *nwcs, struct wcsprm **wcs, - yyscan_t yyscanner); +@@ -20870,58 +20867,37 @@ static const yy_state_type yy_NUL_trans[ + #define DSS 2 + #define WAT 3 +-static int wcspih_scanner(char *header, int nkeyrec, int relax, int ctrl, +- int *nreject, int *nwcs, struct wcsprm **wcs, +- yyscan_t yyscanner); +- -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- - - int wcspih( - char *header, -@@ -20899,7 +20896,7 @@ int wcspih( - return status; - } - +- +-int wcspih( +- char *header, +- int nkeyrec, +- int relax, +- int ctrl, +- int *nreject, +- int *nwcs, +- struct wcsprm **wcs) +- +-{ +- int status; +- yyscan_t yyscanner; +- int yylex_init(yyscan_t *yyscanner); +- int yylex_destroy(yyscan_t yyscanner); +- +- yylex_init(&yyscanner); +- status = wcspih_scanner(header, nkeyrec, relax, ctrl, nreject, nwcs, wcs, +- yyscanner); +- yylex_destroy(yyscanner); +- +- return status; +-} +- -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- ++// User data associated with yyscanner. ++struct wcspih_extra { ++ // Values passed to YY_INPUT. ++ char *hdr; ++ int nkeyrec; ++ ++ // Used in preempting the call to exit() by yy_fatal_error(). ++ jmp_buf abort_jmp_env; ++}; #define YY_DECL int wcspih_scanner(char *header, int nkeyrec, int relax, \ int ctrl, int *nreject, int *nwcs, struct wcsprm **wcs, yyscan_t yyscanner) -@@ -20917,11 +20914,11 @@ int wcspih( + + #define YY_INPUT(inbuff, count, bufsize) \ + { \ +- if (wcspih_nkeyrec) { \ +- strncpy(inbuff, wcspih_hdr, 80); \ ++ if (yyextra->nkeyrec) { \ ++ strncpy(inbuff, yyextra->hdr, 80); \ + inbuff[80] = '\n'; \ +- wcspih_hdr += 80; \ +- wcspih_nkeyrec--; \ ++ yyextra->hdr += 80; \ ++ yyextra->nkeyrec--; \ + count = 81; \ + } else { \ + count = YY_NULL; \ } \ } -/* These global variables are required by YY_INPUT. */ -+// These global variables are required by YY_INPUT. - static char *wcspih_hdr; - static int wcspih_nkeyrec; +-static char *wcspih_hdr; +-static int wcspih_nkeyrec; ++// Preempt the call to exit() by yy_fatal_error(). ++#define exit(status) longjmp(yyextra->abort_jmp_env, status); -/* Internal helper functions. */ +// Internal helper functions. ++static YY_DECL; static int wcspih_final(int ndp[], int ndq[], int distran, double dsstmp[], char *wat[], int *nwcs, struct wcsprm **wcs); static int wcspih_init1(int naxis, int alts[], int dpq[], int npv[], -@@ -20938,12 +20935,12 @@ static int wcspih_vsource(double *wptr, +@@ -20938,12 +20914,8 @@ static int wcspih_vsource(double *wptr, static int wcspih_timepixr(double timepixr); -/* Used in preempting the call to exit() by yy_fatal_error(). */ -+// Used in preempting the call to exit() by yy_fatal_error(). - jmp_buf wcspih_abort_jmp_env; - #define exit(status) longjmp(wcspih_abort_jmp_env, status) - +-jmp_buf wcspih_abort_jmp_env; +-#define exit(status) longjmp(wcspih_abort_jmp_env, status) +- -#line 20946 "wcspih.c" -#line 20947 "wcspih.c" -+#line 20943 "wcspih.c" -+#line 20944 "wcspih.c" ++#line 20918 "wcspih.c" ++#line 20919 "wcspih.c" #define INITIAL 0 #define CCia 1 -@@ -21216,10 +21213,10 @@ YY_DECL +@@ -20981,9 +20953,7 @@ jmp_buf wcspih_abort_jmp_env; + #include + #endif + +-#ifndef YY_EXTRA_TYPE +-#define YY_EXTRA_TYPE void * +-#endif ++#define YY_EXTRA_TYPE struct wcspih_extra * + + /* Holds the entire state of the reentrant scanner. */ + struct yyguts_t +@@ -21216,30 +21186,20 @@ YY_DECL } { -#line 214 "wcspih.l" -+#line 211 "wcspih.l" ++#line 187 "wcspih.l" -#line 216 "wcspih.l" - /* Keyword indices, as used in the WCS papers, e.g. PCi_ja, PVi_ma. */ -+#line 213 "wcspih.l" -+ // Keyword indices, as used in the WCS papers, e.g. PCi_ja, PVi_ma. - char a; - int i, j, m, p, q; +- char a; +- int i, j, m, p, q; +- +- char *cptr, *errmsg, errtxt[80], *hptr, *keep, *keyname, *keyrec, +- keyword[16], strtmp[80], *wat[2], *watstr; +- int altlin, alts[27], auxprm, distran, distype, dpq[27], dssflag, +- gotone, ialt, inttmp, ipass, ipx, ix, jx, naux, naxis, +- ndp[27], ndq[27], nother, *npptr, nps[27], npass, npv[27], +- nvalid, rectype, sipflag, status, valtype, watflag, watn; +- ptrdiff_t voff; ++#line 189 "wcspih.l" ++ int p, q; ++ char *errmsg, errtxt[80], *keyname, strtmp[80], *wat[2], *watstr; ++ int alts[27], dpq[27], inttmp, ndp[27], ndq[27], nps[27], npv[27], ++ rectype; + double dbltmp, dbl2tmp[2], dsstmp[20]; +- void *vptr, *wptr; +- struct auxprm *auxp, auxtem; +- struct disprm *disp, distem; +- struct wcsprm *wcsp, wcstem; +- int (*chekval)(double); +- int (*special)(double *, const double *); ++ struct auxprm auxtem; ++ struct disprm distem; ++ struct wcsprm wcstem; -@@ -21248,34 +21245,34 @@ YY_DECL +- naxis = 0; +- for (ialt = 0; ialt < 27; ialt++) { ++ int naxis = 0; ++ for (int ialt = 0; ialt < 27; ialt++) { + alts[ialt] = 0; + dpq[ialt] = 0; + npv[ialt] = 0; +@@ -21248,63 +21208,64 @@ YY_DECL ndq[ialt] = 0; } - /* Parameters used to implement YY_INPUT. */ -+ // Parameters used to implement YY_INPUT. - wcspih_hdr = header; - wcspih_nkeyrec = nkeyrec; - +- wcspih_hdr = header; +- wcspih_nkeyrec = nkeyrec; +- - /* Our handle on the input stream. */ +- keyrec = header; +- hptr = header; +- keep = 0x0; + // Our handle on the input stream. - keyrec = header; - hptr = header; - keep = 0x0; ++ char *keyrec = header; ++ char *hptr = header; ++ char *keep = 0x0; - /* For keeping tallies of keywords found. */ + // For keeping tallies of keywords found. *nreject = 0; - nvalid = 0; - nother = 0; +- nvalid = 0; +- nother = 0; ++ int nvalid = 0; ++ int nother = 0; - /* If strict, then also reject. */ + // If strict, then also reject. if (relax & WCSHDR_strict) relax |= WCSHDR_reject; - /* Keyword parameters. */ -+ // Keyword parameters. - i = j = 0; - m = 0; - a = ' '; - +- i = j = 0; +- m = 0; +- a = ' '; +- - /* For decoding the keyvalue. */ -+ // For decoding the keyvalue. - valtype = -1; - distype = 0; - vptr = 0x0; - +- valtype = -1; +- distype = 0; +- vptr = 0x0; +- - /* For keywords that require special handling. */ +- altlin = 0; +- npptr = 0x0; +- chekval = 0x0; +- special = 0x0; +- auxprm = 0; +- naux = 0; +- distran = 0; +- sipflag = 0; +- dssflag = 0; +- watflag = 0; +- watn = 0; ++ // Keyword indices, as used in the WCS papers, e.g. PCi_ja, PVi_ma. ++ int i = 0; ++ int j = 0; ++ int m = 0; ++ char a = ' '; ++ ++ // For decoding the keyvalue. ++ int valtype = -1; ++ int distype = 0; ++ void *vptr = 0x0; ++ + // For keywords that require special handling. - altlin = 0; - npptr = 0x0; - chekval = 0x0; -@@ -21288,15 +21285,15 @@ YY_DECL - watflag = 0; - watn = 0; ++ int altlin = 0; ++ int *npptr = 0x0; ++ int (*chekval)(double) = 0x0; ++ int (*special)(double *, const double *) = 0x0; ++ int auxprm = 0; ++ int naux = 0; ++ int distran = 0; ++ int sipflag = 0; ++ int dssflag = 0; ++ int watflag = 0; ++ int watn = 0; - /* The data structures produced. */ + // The data structures produced. @@ -8173,330 +9382,339 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c *wcs = 0x0; - /* Control variables. */ -+ // Control variables. - ipass = 1; - npass = 2; - +- ipass = 1; +- npass = 2; +- - /* Return here via longjmp() invoked by yy_fatal_error(). */ +- if (setjmp(wcspih_abort_jmp_env)) { +- return 3; ++ // Control variables. ++ int ipass = 1; ++ int npass = 2; ++ ++ // User data associated with yyscanner. ++ yyextra->hdr = header; ++ yyextra->nkeyrec = nkeyrec; ++ + // Return here via longjmp() invoked by yy_fatal_error(). - if (setjmp(wcspih_abort_jmp_env)) { - return 3; ++ if (setjmp(yyextra->abort_jmp_env)) { ++ return WCSHDRERR_PARSER; } -@@ -21304,7 +21301,7 @@ YY_DECL + BEGIN(INITIAL); -#line 21308 "wcspih.c" -+#line 21305 "wcspih.c" ++#line 21269 "wcspih.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { -@@ -21352,7 +21349,7 @@ do_action: /* This label is used only to +@@ -21352,7 +21313,7 @@ do_action: /* This label is used only to case 1: YY_RULE_SETUP -#line 301 "wcspih.l" -+#line 298 "wcspih.l" ++#line 265 "wcspih.l" { keyname = "NAXISn"; -@@ -21375,7 +21372,7 @@ YY_RULE_SETUP +@@ -21375,7 +21336,7 @@ YY_RULE_SETUP YY_BREAK case 2: YY_RULE_SETUP -#line 321 "wcspih.l" -+#line 318 "wcspih.l" ++#line 285 "wcspih.l" { sscanf(yytext, "WCSAXES%c= %d", &a, &i); -@@ -21394,7 +21391,7 @@ YY_RULE_SETUP +@@ -21394,7 +21355,7 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 337 "wcspih.l" -+#line 334 "wcspih.l" ++#line 301 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.crpix); -@@ -21405,7 +21402,7 @@ YY_RULE_SETUP +@@ -21405,7 +21366,7 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 345 "wcspih.l" -+#line 342 "wcspih.l" ++#line 309 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.pc); -@@ -21417,7 +21414,7 @@ YY_RULE_SETUP +@@ -21417,7 +21378,7 @@ YY_RULE_SETUP YY_BREAK case 5: YY_RULE_SETUP -#line 354 "wcspih.l" -+#line 351 "wcspih.l" ++#line 318 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.cd); -@@ -21429,7 +21426,7 @@ YY_RULE_SETUP +@@ -21429,7 +21390,7 @@ YY_RULE_SETUP YY_BREAK case 6: YY_RULE_SETUP -#line 363 "wcspih.l" -+#line 360 "wcspih.l" ++#line 327 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.cdelt); -@@ -21440,7 +21437,7 @@ YY_RULE_SETUP +@@ -21440,7 +21401,7 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 371 "wcspih.l" -+#line 368 "wcspih.l" ++#line 335 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.crota); -@@ -21452,7 +21449,7 @@ YY_RULE_SETUP +@@ -21452,7 +21413,7 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 380 "wcspih.l" -+#line 377 "wcspih.l" ++#line 344 "wcspih.l" { valtype = STRING; vptr = &(wcstem.cunit); -@@ -21463,7 +21460,7 @@ YY_RULE_SETUP +@@ -21463,7 +21424,7 @@ YY_RULE_SETUP YY_BREAK case 9: YY_RULE_SETUP -#line 388 "wcspih.l" -+#line 385 "wcspih.l" ++#line 352 "wcspih.l" { valtype = STRING; vptr = &(wcstem.ctype); -@@ -21474,7 +21471,7 @@ YY_RULE_SETUP +@@ -21474,7 +21435,7 @@ YY_RULE_SETUP YY_BREAK case 10: YY_RULE_SETUP -#line 396 "wcspih.l" -+#line 393 "wcspih.l" ++#line 360 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.crval); -@@ -21485,7 +21482,7 @@ YY_RULE_SETUP +@@ -21485,7 +21446,7 @@ YY_RULE_SETUP YY_BREAK case 11: YY_RULE_SETUP -#line 404 "wcspih.l" -+#line 401 "wcspih.l" ++#line 368 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.lonpole); -@@ -21496,7 +21493,7 @@ YY_RULE_SETUP +@@ -21496,7 +21457,7 @@ YY_RULE_SETUP YY_BREAK case 12: YY_RULE_SETUP -#line 412 "wcspih.l" -+#line 409 "wcspih.l" ++#line 376 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.latpole); -@@ -21507,7 +21504,7 @@ YY_RULE_SETUP +@@ -21507,7 +21468,7 @@ YY_RULE_SETUP YY_BREAK case 13: YY_RULE_SETUP -#line 420 "wcspih.l" -+#line 417 "wcspih.l" ++#line 384 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.restfrq); -@@ -21518,7 +21515,7 @@ YY_RULE_SETUP +@@ -21518,7 +21479,7 @@ YY_RULE_SETUP YY_BREAK case 14: YY_RULE_SETUP -#line 428 "wcspih.l" -+#line 425 "wcspih.l" ++#line 392 "wcspih.l" { if (relax & WCSHDR_strict) { errmsg = "the RESTFREQ keyword is deprecated, use RESTFRQa"; -@@ -21537,7 +21534,7 @@ YY_RULE_SETUP +@@ -21537,7 +21498,7 @@ YY_RULE_SETUP YY_BREAK case 15: YY_RULE_SETUP -#line 444 "wcspih.l" -+#line 441 "wcspih.l" ++#line 408 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.restwav); -@@ -21548,7 +21545,7 @@ YY_RULE_SETUP +@@ -21548,7 +21509,7 @@ YY_RULE_SETUP YY_BREAK case 16: YY_RULE_SETUP -#line 452 "wcspih.l" -+#line 449 "wcspih.l" ++#line 416 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.pv); -@@ -21560,7 +21557,7 @@ YY_RULE_SETUP +@@ -21560,7 +21521,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 461 "wcspih.l" -+#line 458 "wcspih.l" ++#line 425 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.pv); -@@ -21572,7 +21569,7 @@ YY_RULE_SETUP +@@ -21572,7 +21533,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 470 "wcspih.l" -+#line 467 "wcspih.l" ++#line 434 "wcspih.l" { valtype = STRING; vptr = &(wcstem.ps); -@@ -21584,7 +21581,7 @@ YY_RULE_SETUP +@@ -21584,7 +21545,7 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 479 "wcspih.l" -+#line 476 "wcspih.l" ++#line 443 "wcspih.l" { sscanf(yytext, "VELREF%c", &a); -@@ -21612,7 +21609,7 @@ YY_RULE_SETUP +@@ -21612,7 +21573,7 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 504 "wcspih.l" -+#line 501 "wcspih.l" ++#line 468 "wcspih.l" { valtype = STRING; vptr = &(wcstem.cname); -@@ -21623,7 +21620,7 @@ YY_RULE_SETUP +@@ -21623,7 +21584,7 @@ YY_RULE_SETUP YY_BREAK case 21: YY_RULE_SETUP -#line 512 "wcspih.l" -+#line 509 "wcspih.l" ++#line 476 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.crder); -@@ -21634,7 +21631,7 @@ YY_RULE_SETUP +@@ -21634,7 +21595,7 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 520 "wcspih.l" -+#line 517 "wcspih.l" ++#line 484 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.csyer); -@@ -21645,7 +21642,7 @@ YY_RULE_SETUP +@@ -21645,7 +21606,7 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 528 "wcspih.l" -+#line 525 "wcspih.l" ++#line 492 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.czphs); -@@ -21656,7 +21653,7 @@ YY_RULE_SETUP +@@ -21656,7 +21617,7 @@ YY_RULE_SETUP YY_BREAK case 24: YY_RULE_SETUP -#line 536 "wcspih.l" -+#line 533 "wcspih.l" ++#line 500 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.cperi); -@@ -21667,7 +21664,7 @@ YY_RULE_SETUP +@@ -21667,7 +21628,7 @@ YY_RULE_SETUP YY_BREAK case 25: YY_RULE_SETUP -#line 544 "wcspih.l" -+#line 541 "wcspih.l" ++#line 508 "wcspih.l" { valtype = STRING; vptr = wcstem.wcsname; -@@ -21678,7 +21675,7 @@ YY_RULE_SETUP +@@ -21678,7 +21639,7 @@ YY_RULE_SETUP YY_BREAK case 26: YY_RULE_SETUP -#line 552 "wcspih.l" -+#line 549 "wcspih.l" ++#line 516 "wcspih.l" { valtype = STRING; vptr = wcstem.timesys; -@@ -21689,7 +21686,7 @@ YY_RULE_SETUP +@@ -21689,7 +21650,7 @@ YY_RULE_SETUP YY_BREAK case 27: YY_RULE_SETUP -#line 560 "wcspih.l" -+#line 557 "wcspih.l" ++#line 524 "wcspih.l" { valtype = STRING; vptr = wcstem.trefpos; -@@ -21700,7 +21697,7 @@ YY_RULE_SETUP +@@ -21700,7 +21661,7 @@ YY_RULE_SETUP YY_BREAK case 28: YY_RULE_SETUP -#line 568 "wcspih.l" -+#line 565 "wcspih.l" ++#line 532 "wcspih.l" { valtype = STRING; vptr = wcstem.trefdir; -@@ -21711,7 +21708,7 @@ YY_RULE_SETUP +@@ -21711,7 +21672,7 @@ YY_RULE_SETUP YY_BREAK case 29: YY_RULE_SETUP -#line 576 "wcspih.l" -+#line 573 "wcspih.l" ++#line 540 "wcspih.l" { valtype = STRING; vptr = wcstem.plephem; -@@ -21722,7 +21719,7 @@ YY_RULE_SETUP +@@ -21722,7 +21683,7 @@ YY_RULE_SETUP YY_BREAK case 30: YY_RULE_SETUP -#line 584 "wcspih.l" -+#line 581 "wcspih.l" ++#line 548 "wcspih.l" { valtype = STRING; vptr = wcstem.timeunit; -@@ -21732,10 +21729,10 @@ YY_RULE_SETUP +@@ -21732,10 +21693,10 @@ YY_RULE_SETUP } YY_BREAK case 31: -#line 593 "wcspih.l" -+#line 590 "wcspih.l" ++#line 557 "wcspih.l" case 32: YY_RULE_SETUP -#line 593 "wcspih.l" -+#line 590 "wcspih.l" ++#line 557 "wcspih.l" { if ((yytext[4] == 'R') || (relax & WCSHDR_DATEREF)) { valtype = STRING; -@@ -21754,10 +21751,10 @@ YY_RULE_SETUP +@@ -21754,10 +21715,10 @@ YY_RULE_SETUP } YY_BREAK case 33: -#line 611 "wcspih.l" -+#line 608 "wcspih.l" ++#line 575 "wcspih.l" case 34: YY_RULE_SETUP -#line 611 "wcspih.l" -+#line 608 "wcspih.l" ++#line 575 "wcspih.l" { if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) { valtype = FLOAT2; -@@ -21776,13 +21773,13 @@ YY_RULE_SETUP +@@ -21776,13 +21737,13 @@ YY_RULE_SETUP } YY_BREAK case 35: -#line 629 "wcspih.l" -+#line 626 "wcspih.l" ++#line 593 "wcspih.l" case 36: YY_RULE_SETUP -#line 629 "wcspih.l" -+#line 626 "wcspih.l" ++#line 593 "wcspih.l" { if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) { - /* Actually integer, but treated as float. */ @@ -8504,42 +9722,42 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c valtype = FLOAT; vptr = wcstem.mjdref; -@@ -21799,10 +21796,10 @@ YY_RULE_SETUP +@@ -21799,10 +21760,10 @@ YY_RULE_SETUP } YY_BREAK case 37: -#line 648 "wcspih.l" -+#line 645 "wcspih.l" ++#line 612 "wcspih.l" case 38: YY_RULE_SETUP -#line 648 "wcspih.l" -+#line 645 "wcspih.l" ++#line 612 "wcspih.l" { if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) { valtype = FLOAT; -@@ -21821,10 +21818,10 @@ YY_RULE_SETUP +@@ -21821,10 +21782,10 @@ YY_RULE_SETUP } YY_BREAK case 39: -#line 666 "wcspih.l" -+#line 663 "wcspih.l" ++#line 630 "wcspih.l" case 40: YY_RULE_SETUP -#line 666 "wcspih.l" -+#line 663 "wcspih.l" ++#line 630 "wcspih.l" { if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) { valtype = FLOAT2; -@@ -21844,13 +21841,13 @@ YY_RULE_SETUP +@@ -21844,13 +21805,13 @@ YY_RULE_SETUP } YY_BREAK case 41: -#line 685 "wcspih.l" -+#line 682 "wcspih.l" ++#line 649 "wcspih.l" case 42: YY_RULE_SETUP -#line 685 "wcspih.l" -+#line 682 "wcspih.l" ++#line 649 "wcspih.l" { if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) { - /* Actually integer, but treated as float. */ @@ -8547,820 +9765,825 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c valtype = FLOAT; vptr = wcstem.mjdref; special = wcspih_jdrefi; -@@ -21868,10 +21865,10 @@ YY_RULE_SETUP +@@ -21868,10 +21829,10 @@ YY_RULE_SETUP } YY_BREAK case 43: -#line 705 "wcspih.l" -+#line 702 "wcspih.l" ++#line 669 "wcspih.l" case 44: YY_RULE_SETUP -#line 705 "wcspih.l" -+#line 702 "wcspih.l" ++#line 669 "wcspih.l" { if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) { valtype = FLOAT; -@@ -21892,7 +21889,7 @@ YY_RULE_SETUP +@@ -21892,7 +21853,7 @@ YY_RULE_SETUP YY_BREAK case 45: YY_RULE_SETUP -#line 723 "wcspih.l" -+#line 720 "wcspih.l" ++#line 687 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.timeoffs); -@@ -21903,7 +21900,7 @@ YY_RULE_SETUP +@@ -21903,7 +21864,7 @@ YY_RULE_SETUP YY_BREAK case 46: YY_RULE_SETUP -#line 731 "wcspih.l" -+#line 728 "wcspih.l" ++#line 695 "wcspih.l" { valtype = STRING; vptr = wcstem.dateobs; -@@ -21915,7 +21912,7 @@ YY_RULE_SETUP +@@ -21915,7 +21876,7 @@ YY_RULE_SETUP YY_BREAK case 47: YY_RULE_SETUP -#line 740 "wcspih.l" -+#line 737 "wcspih.l" ++#line 704 "wcspih.l" { valtype = STRING; vptr = wcstem.datebeg; -@@ -21927,7 +21924,7 @@ YY_RULE_SETUP +@@ -21927,7 +21888,7 @@ YY_RULE_SETUP YY_BREAK case 48: YY_RULE_SETUP -#line 749 "wcspih.l" -+#line 746 "wcspih.l" ++#line 713 "wcspih.l" { valtype = STRING; vptr = wcstem.dateavg; -@@ -21939,7 +21936,7 @@ YY_RULE_SETUP +@@ -21939,7 +21900,7 @@ YY_RULE_SETUP YY_BREAK case 49: YY_RULE_SETUP -#line 758 "wcspih.l" -+#line 755 "wcspih.l" ++#line 722 "wcspih.l" { valtype = STRING; vptr = wcstem.dateend; -@@ -21951,7 +21948,7 @@ YY_RULE_SETUP +@@ -21951,7 +21912,7 @@ YY_RULE_SETUP YY_BREAK case 50: YY_RULE_SETUP -#line 767 "wcspih.l" -+#line 764 "wcspih.l" ++#line 731 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.mjdobs); -@@ -21963,7 +21960,7 @@ YY_RULE_SETUP +@@ -21963,7 +21924,7 @@ YY_RULE_SETUP YY_BREAK case 51: YY_RULE_SETUP -#line 776 "wcspih.l" -+#line 773 "wcspih.l" ++#line 740 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.mjdbeg); -@@ -21975,7 +21972,7 @@ YY_RULE_SETUP +@@ -21975,7 +21936,7 @@ YY_RULE_SETUP YY_BREAK case 52: YY_RULE_SETUP -#line 785 "wcspih.l" -+#line 782 "wcspih.l" ++#line 749 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.mjdavg); -@@ -21987,7 +21984,7 @@ YY_RULE_SETUP +@@ -21987,7 +21948,7 @@ YY_RULE_SETUP YY_BREAK case 53: YY_RULE_SETUP -#line 794 "wcspih.l" -+#line 791 "wcspih.l" ++#line 758 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.mjdend); -@@ -21999,7 +21996,7 @@ YY_RULE_SETUP +@@ -21999,7 +21960,7 @@ YY_RULE_SETUP YY_BREAK case 54: YY_RULE_SETUP -#line 803 "wcspih.l" -+#line 800 "wcspih.l" ++#line 767 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.jepoch); -@@ -22011,7 +22008,7 @@ YY_RULE_SETUP +@@ -22011,7 +21972,7 @@ YY_RULE_SETUP YY_BREAK case 55: YY_RULE_SETUP -#line 812 "wcspih.l" -+#line 809 "wcspih.l" ++#line 776 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.bepoch); -@@ -22023,7 +22020,7 @@ YY_RULE_SETUP +@@ -22023,7 +21984,7 @@ YY_RULE_SETUP YY_BREAK case 56: YY_RULE_SETUP -#line 821 "wcspih.l" -+#line 818 "wcspih.l" ++#line 785 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.tstart); -@@ -22035,7 +22032,7 @@ YY_RULE_SETUP +@@ -22035,7 +21996,7 @@ YY_RULE_SETUP YY_BREAK case 57: YY_RULE_SETUP -#line 830 "wcspih.l" -+#line 827 "wcspih.l" ++#line 794 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.tstop); -@@ -22047,7 +22044,7 @@ YY_RULE_SETUP +@@ -22047,7 +22008,7 @@ YY_RULE_SETUP YY_BREAK case 58: YY_RULE_SETUP -#line 839 "wcspih.l" -+#line 836 "wcspih.l" ++#line 803 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.xposure); -@@ -22059,7 +22056,7 @@ YY_RULE_SETUP +@@ -22059,7 +22020,7 @@ YY_RULE_SETUP YY_BREAK case 59: YY_RULE_SETUP -#line 848 "wcspih.l" -+#line 845 "wcspih.l" ++#line 812 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.telapse); -@@ -22071,7 +22068,7 @@ YY_RULE_SETUP +@@ -22071,7 +22032,7 @@ YY_RULE_SETUP YY_BREAK case 60: YY_RULE_SETUP -#line 857 "wcspih.l" -+#line 854 "wcspih.l" ++#line 821 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.timsyer); -@@ -22083,7 +22080,7 @@ YY_RULE_SETUP +@@ -22083,7 +22044,7 @@ YY_RULE_SETUP YY_BREAK case 61: YY_RULE_SETUP -#line 866 "wcspih.l" -+#line 863 "wcspih.l" ++#line 830 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.timrder); -@@ -22095,7 +22092,7 @@ YY_RULE_SETUP +@@ -22095,7 +22056,7 @@ YY_RULE_SETUP YY_BREAK case 62: YY_RULE_SETUP -#line 875 "wcspih.l" -+#line 872 "wcspih.l" ++#line 839 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.timedel); -@@ -22107,7 +22104,7 @@ YY_RULE_SETUP +@@ -22107,7 +22068,7 @@ YY_RULE_SETUP YY_BREAK case 63: YY_RULE_SETUP -#line 884 "wcspih.l" -+#line 881 "wcspih.l" ++#line 848 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.timepixr); -@@ -22120,7 +22117,7 @@ YY_RULE_SETUP +@@ -22120,7 +22081,7 @@ YY_RULE_SETUP YY_BREAK case 64: YY_RULE_SETUP -#line 894 "wcspih.l" -+#line 891 "wcspih.l" ++#line 858 "wcspih.l" { valtype = FLOAT; vptr = wcstem.obsgeo; -@@ -22132,7 +22129,7 @@ YY_RULE_SETUP +@@ -22132,7 +22093,7 @@ YY_RULE_SETUP YY_BREAK case 65: YY_RULE_SETUP -#line 903 "wcspih.l" -+#line 900 "wcspih.l" ++#line 867 "wcspih.l" { valtype = FLOAT; vptr = wcstem.obsgeo + 1; -@@ -22144,7 +22141,7 @@ YY_RULE_SETUP +@@ -22144,7 +22105,7 @@ YY_RULE_SETUP YY_BREAK case 66: YY_RULE_SETUP -#line 912 "wcspih.l" -+#line 909 "wcspih.l" ++#line 876 "wcspih.l" { valtype = FLOAT; vptr = wcstem.obsgeo + 2; -@@ -22156,7 +22153,7 @@ YY_RULE_SETUP +@@ -22156,7 +22117,7 @@ YY_RULE_SETUP YY_BREAK case 67: YY_RULE_SETUP -#line 921 "wcspih.l" -+#line 918 "wcspih.l" ++#line 885 "wcspih.l" { valtype = FLOAT; vptr = wcstem.obsgeo + 3; -@@ -22168,7 +22165,7 @@ YY_RULE_SETUP +@@ -22168,7 +22129,7 @@ YY_RULE_SETUP YY_BREAK case 68: YY_RULE_SETUP -#line 930 "wcspih.l" -+#line 927 "wcspih.l" ++#line 894 "wcspih.l" { valtype = FLOAT; vptr = wcstem.obsgeo + 4; -@@ -22180,7 +22177,7 @@ YY_RULE_SETUP +@@ -22180,7 +22141,7 @@ YY_RULE_SETUP YY_BREAK case 69: YY_RULE_SETUP -#line 939 "wcspih.l" -+#line 936 "wcspih.l" ++#line 903 "wcspih.l" { valtype = FLOAT; vptr = wcstem.obsgeo + 5; -@@ -22192,7 +22189,7 @@ YY_RULE_SETUP +@@ -22192,7 +22153,7 @@ YY_RULE_SETUP YY_BREAK case 70: YY_RULE_SETUP -#line 948 "wcspih.l" -+#line 945 "wcspih.l" ++#line 912 "wcspih.l" { valtype = STRING; vptr = wcstem.obsorbit; -@@ -22203,7 +22200,7 @@ YY_RULE_SETUP +@@ -22203,7 +22164,7 @@ YY_RULE_SETUP YY_BREAK case 71: YY_RULE_SETUP -#line 956 "wcspih.l" -+#line 953 "wcspih.l" ++#line 920 "wcspih.l" { valtype = STRING; vptr = wcstem.radesys; -@@ -22214,7 +22211,7 @@ YY_RULE_SETUP +@@ -22214,7 +22175,7 @@ YY_RULE_SETUP YY_BREAK case 72: YY_RULE_SETUP -#line 964 "wcspih.l" -+#line 961 "wcspih.l" ++#line 928 "wcspih.l" { if (relax & WCSHDR_RADECSYS) { valtype = STRING; -@@ -22236,7 +22233,7 @@ YY_RULE_SETUP +@@ -22236,7 +22197,7 @@ YY_RULE_SETUP YY_BREAK case 73: YY_RULE_SETUP -#line 983 "wcspih.l" -+#line 980 "wcspih.l" ++#line 947 "wcspih.l" { sscanf(yytext, "EPOCH%c", &a); -@@ -22265,7 +22262,7 @@ YY_RULE_SETUP +@@ -22265,7 +22226,7 @@ YY_RULE_SETUP YY_BREAK case 74: YY_RULE_SETUP -#line 1009 "wcspih.l" -+#line 1006 "wcspih.l" ++#line 973 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.equinox); -@@ -22276,7 +22273,7 @@ YY_RULE_SETUP +@@ -22276,7 +22237,7 @@ YY_RULE_SETUP YY_BREAK case 75: YY_RULE_SETUP -#line 1017 "wcspih.l" -+#line 1014 "wcspih.l" ++#line 981 "wcspih.l" { valtype = STRING; vptr = wcstem.specsys; -@@ -22287,7 +22284,7 @@ YY_RULE_SETUP +@@ -22287,7 +22248,7 @@ YY_RULE_SETUP YY_BREAK case 76: YY_RULE_SETUP -#line 1025 "wcspih.l" -+#line 1022 "wcspih.l" ++#line 989 "wcspih.l" { valtype = STRING; vptr = wcstem.ssysobs; -@@ -22298,7 +22295,7 @@ YY_RULE_SETUP +@@ -22298,7 +22259,7 @@ YY_RULE_SETUP YY_BREAK case 77: YY_RULE_SETUP -#line 1033 "wcspih.l" -+#line 1030 "wcspih.l" ++#line 997 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.velosys); -@@ -22309,7 +22306,7 @@ YY_RULE_SETUP +@@ -22309,7 +22270,7 @@ YY_RULE_SETUP YY_BREAK case 78: YY_RULE_SETUP -#line 1041 "wcspih.l" -+#line 1038 "wcspih.l" ++#line 1005 "wcspih.l" { if (relax & WCSHDR_VSOURCE) { valtype = FLOAT; -@@ -22332,7 +22329,7 @@ YY_RULE_SETUP +@@ -22332,7 +22293,7 @@ YY_RULE_SETUP YY_BREAK case 79: YY_RULE_SETUP -#line 1061 "wcspih.l" -+#line 1058 "wcspih.l" ++#line 1025 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.zsource); -@@ -22343,7 +22340,7 @@ YY_RULE_SETUP +@@ -22343,7 +22304,7 @@ YY_RULE_SETUP YY_BREAK case 80: YY_RULE_SETUP -#line 1069 "wcspih.l" -+#line 1066 "wcspih.l" ++#line 1033 "wcspih.l" { valtype = STRING; vptr = wcstem.ssyssrc; -@@ -22354,7 +22351,7 @@ YY_RULE_SETUP +@@ -22354,7 +22315,7 @@ YY_RULE_SETUP YY_BREAK case 81: YY_RULE_SETUP -#line 1077 "wcspih.l" -+#line 1074 "wcspih.l" ++#line 1041 "wcspih.l" { valtype = FLOAT; vptr = &(wcstem.velangl); -@@ -22365,7 +22362,7 @@ YY_RULE_SETUP +@@ -22365,7 +22326,7 @@ YY_RULE_SETUP YY_BREAK case 82: YY_RULE_SETUP -#line 1085 "wcspih.l" -+#line 1082 "wcspih.l" ++#line 1049 "wcspih.l" { valtype = FLOAT; auxprm = 1; -@@ -22377,7 +22374,7 @@ YY_RULE_SETUP +@@ -22377,7 +22338,7 @@ YY_RULE_SETUP YY_BREAK case 83: YY_RULE_SETUP -#line 1094 "wcspih.l" -+#line 1091 "wcspih.l" ++#line 1058 "wcspih.l" { valtype = FLOAT; auxprm = 1; -@@ -22389,7 +22386,7 @@ YY_RULE_SETUP +@@ -22389,7 +22350,7 @@ YY_RULE_SETUP YY_BREAK case 84: YY_RULE_SETUP -#line 1103 "wcspih.l" -+#line 1100 "wcspih.l" ++#line 1067 "wcspih.l" { valtype = FLOAT; auxprm = 1; -@@ -22401,7 +22398,7 @@ YY_RULE_SETUP +@@ -22401,7 +22362,7 @@ YY_RULE_SETUP YY_BREAK case 85: YY_RULE_SETUP -#line 1112 "wcspih.l" -+#line 1109 "wcspih.l" ++#line 1076 "wcspih.l" { valtype = FLOAT; auxprm = 1; -@@ -22412,10 +22409,10 @@ YY_RULE_SETUP +@@ -22412,10 +22373,10 @@ YY_RULE_SETUP } YY_BREAK case 86: -#line 1122 "wcspih.l" -+#line 1119 "wcspih.l" ++#line 1086 "wcspih.l" case 87: YY_RULE_SETUP -#line 1122 "wcspih.l" -+#line 1119 "wcspih.l" ++#line 1086 "wcspih.l" { valtype = FLOAT; auxprm = 1; -@@ -22427,7 +22424,7 @@ YY_RULE_SETUP +@@ -22427,7 +22388,7 @@ YY_RULE_SETUP YY_BREAK case 88: YY_RULE_SETUP -#line 1131 "wcspih.l" -+#line 1128 "wcspih.l" ++#line 1095 "wcspih.l" { valtype = STRING; distype = PRIOR; -@@ -22439,7 +22436,7 @@ YY_RULE_SETUP +@@ -22439,7 +22400,7 @@ YY_RULE_SETUP YY_BREAK case 89: YY_RULE_SETUP -#line 1140 "wcspih.l" -+#line 1137 "wcspih.l" ++#line 1104 "wcspih.l" { valtype = STRING; distype = SEQUENT; -@@ -22451,7 +22448,7 @@ YY_RULE_SETUP +@@ -22451,7 +22412,7 @@ YY_RULE_SETUP YY_BREAK case 90: YY_RULE_SETUP -#line 1149 "wcspih.l" -+#line 1146 "wcspih.l" ++#line 1113 "wcspih.l" { valtype = RECORD; distype = PRIOR; -@@ -22464,7 +22461,7 @@ YY_RULE_SETUP +@@ -22464,7 +22425,7 @@ YY_RULE_SETUP YY_BREAK case 91: YY_RULE_SETUP -#line 1159 "wcspih.l" -+#line 1156 "wcspih.l" ++#line 1123 "wcspih.l" { valtype = RECORD; distype = SEQUENT; -@@ -22477,7 +22474,7 @@ YY_RULE_SETUP +@@ -22477,7 +22438,7 @@ YY_RULE_SETUP YY_BREAK case 92: YY_RULE_SETUP -#line 1169 "wcspih.l" -+#line 1166 "wcspih.l" ++#line 1133 "wcspih.l" { valtype = FLOAT; distype = PRIOR; -@@ -22489,7 +22486,7 @@ YY_RULE_SETUP +@@ -22489,7 +22450,7 @@ YY_RULE_SETUP YY_BREAK case 93: YY_RULE_SETUP -#line 1178 "wcspih.l" -+#line 1175 "wcspih.l" ++#line 1142 "wcspih.l" { valtype = FLOAT; distype = SEQUENT; -@@ -22501,7 +22498,7 @@ YY_RULE_SETUP +@@ -22501,7 +22462,7 @@ YY_RULE_SETUP YY_BREAK case 94: YY_RULE_SETUP -#line 1187 "wcspih.l" -+#line 1184 "wcspih.l" ++#line 1151 "wcspih.l" { valtype = FLOAT; distype = PRIOR; -@@ -22513,9 +22510,9 @@ YY_RULE_SETUP +@@ -22513,9 +22474,9 @@ YY_RULE_SETUP YY_BREAK case 95: YY_RULE_SETUP -#line 1196 "wcspih.l" -+#line 1193 "wcspih.l" ++#line 1160 "wcspih.l" { - /* SIP: axis 1 polynomial degree (not stored). */ + // SIP: axis 1 polynomial degree (not stored). valtype = INTEGER; distype = PRIOR; vptr = 0x0; -@@ -22529,9 +22526,9 @@ YY_RULE_SETUP +@@ -22529,9 +22490,9 @@ YY_RULE_SETUP YY_BREAK case 96: YY_RULE_SETUP -#line 1209 "wcspih.l" -+#line 1206 "wcspih.l" ++#line 1173 "wcspih.l" { - /* SIP: axis 2 polynomial degree (not stored). */ + // SIP: axis 2 polynomial degree (not stored). valtype = INTEGER; distype = PRIOR; vptr = 0x0; -@@ -22545,9 +22542,9 @@ YY_RULE_SETUP +@@ -22545,9 +22506,9 @@ YY_RULE_SETUP YY_BREAK case 97: YY_RULE_SETUP -#line 1222 "wcspih.l" -+#line 1219 "wcspih.l" ++#line 1186 "wcspih.l" { - /* SIP: axis 1 inverse polynomial degree (not stored). */ + // SIP: axis 1 inverse polynomial degree (not stored). valtype = INTEGER; distype = PRIOR; vptr = 0x0; -@@ -22561,9 +22558,9 @@ YY_RULE_SETUP +@@ -22561,9 +22522,9 @@ YY_RULE_SETUP YY_BREAK case 98: YY_RULE_SETUP -#line 1235 "wcspih.l" -+#line 1232 "wcspih.l" ++#line 1199 "wcspih.l" { - /* SIP: axis 2 inverse polynomial degree (not stored). */ + // SIP: axis 2 inverse polynomial degree (not stored). valtype = INTEGER; distype = PRIOR; vptr = 0x0; -@@ -22577,9 +22574,9 @@ YY_RULE_SETUP +@@ -22577,9 +22538,9 @@ YY_RULE_SETUP YY_BREAK case 99: YY_RULE_SETUP -#line 1248 "wcspih.l" -+#line 1245 "wcspih.l" ++#line 1212 "wcspih.l" { - /* SIP: axis 1 maximum distortion. */ + // SIP: axis 1 maximum distortion. valtype = FLOAT; distype = PRIOR; vptr = &(distem.maxdis); -@@ -22593,9 +22590,9 @@ YY_RULE_SETUP +@@ -22593,9 +22554,9 @@ YY_RULE_SETUP YY_BREAK case 100: YY_RULE_SETUP -#line 1261 "wcspih.l" -+#line 1258 "wcspih.l" ++#line 1225 "wcspih.l" { - /* SIP: axis 2 maximum distortion. */ + // SIP: axis 2 maximum distortion. valtype = FLOAT; distype = PRIOR; vptr = &(distem.maxdis); -@@ -22609,9 +22606,9 @@ YY_RULE_SETUP +@@ -22609,9 +22570,9 @@ YY_RULE_SETUP YY_BREAK case 101: YY_RULE_SETUP -#line 1274 "wcspih.l" -+#line 1271 "wcspih.l" ++#line 1238 "wcspih.l" { - /* SIP: axis 1 polynomial coefficient. */ + // SIP: axis 1 polynomial coefficient. i = 1; sipflag = 2; -@@ -22621,9 +22618,9 @@ YY_RULE_SETUP +@@ -22621,9 +22582,9 @@ YY_RULE_SETUP YY_BREAK case 102: YY_RULE_SETUP -#line 1283 "wcspih.l" -+#line 1280 "wcspih.l" ++#line 1247 "wcspih.l" { - /* SIP: axis 2 polynomial coefficient. */ + // SIP: axis 2 polynomial coefficient. i = 2; sipflag = 2; -@@ -22633,9 +22630,9 @@ YY_RULE_SETUP +@@ -22633,9 +22594,9 @@ YY_RULE_SETUP YY_BREAK case 103: YY_RULE_SETUP -#line 1292 "wcspih.l" -+#line 1289 "wcspih.l" ++#line 1256 "wcspih.l" { - /* SIP: axis 1 inverse polynomial coefficient. */ + // SIP: axis 1 inverse polynomial coefficient. i = 1; sipflag = 3; -@@ -22645,9 +22642,9 @@ YY_RULE_SETUP +@@ -22645,9 +22606,9 @@ YY_RULE_SETUP YY_BREAK case 104: YY_RULE_SETUP -#line 1301 "wcspih.l" -+#line 1298 "wcspih.l" ++#line 1265 "wcspih.l" { - /* SIP: axis 2 inverse polynomial coefficient. */ + // SIP: axis 2 inverse polynomial coefficient. i = 2; sipflag = 3; -@@ -22657,9 +22654,9 @@ YY_RULE_SETUP +@@ -22657,9 +22618,9 @@ YY_RULE_SETUP YY_BREAK case 105: YY_RULE_SETUP -#line 1310 "wcspih.l" -+#line 1307 "wcspih.l" ++#line 1274 "wcspih.l" { - /* DSS: LLH corner pixel coordinate 1. */ + // DSS: LLH corner pixel coordinate 1. valtype = FLOAT; distype = SEQUENT; vptr = dsstmp; -@@ -22672,9 +22669,9 @@ YY_RULE_SETUP +@@ -22672,9 +22633,9 @@ YY_RULE_SETUP YY_BREAK case 106: YY_RULE_SETUP -#line 1322 "wcspih.l" -+#line 1319 "wcspih.l" ++#line 1286 "wcspih.l" { - /* DSS: LLH corner pixel coordinate 2. */ + // DSS: LLH corner pixel coordinate 2. valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+1; -@@ -22687,9 +22684,9 @@ YY_RULE_SETUP +@@ -22687,9 +22648,9 @@ YY_RULE_SETUP YY_BREAK case 107: YY_RULE_SETUP -#line 1334 "wcspih.l" -+#line 1331 "wcspih.l" ++#line 1298 "wcspih.l" { - /* DSS: plate centre x-coordinate in micron. */ + // DSS: plate centre x-coordinate in micron. valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+2; -@@ -22702,9 +22699,9 @@ YY_RULE_SETUP +@@ -22702,9 +22663,9 @@ YY_RULE_SETUP YY_BREAK case 108: YY_RULE_SETUP -#line 1346 "wcspih.l" -+#line 1343 "wcspih.l" ++#line 1310 "wcspih.l" { - /* DSS: plate centre y-coordinate in micron. */ + // DSS: plate centre y-coordinate in micron. valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+3; -@@ -22717,9 +22714,9 @@ YY_RULE_SETUP +@@ -22717,9 +22678,9 @@ YY_RULE_SETUP YY_BREAK case 109: YY_RULE_SETUP -#line 1358 "wcspih.l" -+#line 1355 "wcspih.l" ++#line 1322 "wcspih.l" { - /* DSS: pixel x-dimension in micron. */ + // DSS: pixel x-dimension in micron. valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+4; -@@ -22732,9 +22729,9 @@ YY_RULE_SETUP +@@ -22732,9 +22693,9 @@ YY_RULE_SETUP YY_BREAK case 110: YY_RULE_SETUP -#line 1370 "wcspih.l" -+#line 1367 "wcspih.l" ++#line 1334 "wcspih.l" { - /* DSS: pixel y-dimension in micron. */ + // DSS: pixel y-dimension in micron. valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+5; -@@ -22747,9 +22744,9 @@ YY_RULE_SETUP +@@ -22747,9 +22708,9 @@ YY_RULE_SETUP YY_BREAK case 111: YY_RULE_SETUP -#line 1382 "wcspih.l" -+#line 1379 "wcspih.l" ++#line 1346 "wcspih.l" { - /* DSS: plate centre, right ascension - hours. */ + // DSS: plate centre, right ascension - hours. valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+6; -@@ -22762,9 +22759,9 @@ YY_RULE_SETUP +@@ -22762,9 +22723,9 @@ YY_RULE_SETUP YY_BREAK case 112: YY_RULE_SETUP -#line 1394 "wcspih.l" -+#line 1391 "wcspih.l" ++#line 1358 "wcspih.l" { - /* DSS: plate centre, right ascension - minutes. */ + // DSS: plate centre, right ascension - minutes. valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+7; -@@ -22777,9 +22774,9 @@ YY_RULE_SETUP +@@ -22777,9 +22738,9 @@ YY_RULE_SETUP YY_BREAK case 113: YY_RULE_SETUP -#line 1406 "wcspih.l" -+#line 1403 "wcspih.l" ++#line 1370 "wcspih.l" { - /* DSS: plate centre, right ascension - seconds. */ + // DSS: plate centre, right ascension - seconds. valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+8; -@@ -22792,9 +22789,9 @@ YY_RULE_SETUP +@@ -22792,9 +22753,9 @@ YY_RULE_SETUP YY_BREAK case 114: YY_RULE_SETUP -#line 1418 "wcspih.l" -+#line 1415 "wcspih.l" ++#line 1382 "wcspih.l" { - /* DSS: plate centre, declination - sign. */ + // DSS: plate centre, declination - sign. valtype = STRING; distype = SEQUENT; vptr = dsstmp+9; -@@ -22807,9 +22804,9 @@ YY_RULE_SETUP +@@ -22807,9 +22768,9 @@ YY_RULE_SETUP YY_BREAK case 115: YY_RULE_SETUP -#line 1430 "wcspih.l" -+#line 1427 "wcspih.l" ++#line 1394 "wcspih.l" { - /* DSS: plate centre, declination - degrees. */ + // DSS: plate centre, declination - degrees. valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+10; -@@ -22822,9 +22819,9 @@ YY_RULE_SETUP +@@ -22822,9 +22783,9 @@ YY_RULE_SETUP YY_BREAK case 116: YY_RULE_SETUP -#line 1442 "wcspih.l" -+#line 1439 "wcspih.l" ++#line 1406 "wcspih.l" { - /* DSS: plate centre, declination - arcmin. */ + // DSS: plate centre, declination - arcmin. valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+11; -@@ -22837,9 +22834,9 @@ YY_RULE_SETUP +@@ -22837,9 +22798,9 @@ YY_RULE_SETUP YY_BREAK case 117: YY_RULE_SETUP -#line 1454 "wcspih.l" -+#line 1451 "wcspih.l" ++#line 1418 "wcspih.l" { - /* DSS: plate centre, declination - arcsec. */ + // DSS: plate centre, declination - arcsec. valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+12; -@@ -22852,9 +22849,9 @@ YY_RULE_SETUP +@@ -22852,9 +22813,9 @@ YY_RULE_SETUP YY_BREAK case 118: YY_RULE_SETUP -#line 1466 "wcspih.l" -+#line 1463 "wcspih.l" ++#line 1430 "wcspih.l" { - /* DSS: plate identification (insufficient to trigger DSS). */ + // DSS: plate identification (insufficient to trigger DSS). valtype = STRING; distype = SEQUENT; vptr = dsstmp+13; -@@ -22867,9 +22864,9 @@ YY_RULE_SETUP +@@ -22867,9 +22828,9 @@ YY_RULE_SETUP YY_BREAK case 119: YY_RULE_SETUP -#line 1478 "wcspih.l" -+#line 1475 "wcspih.l" ++#line 1442 "wcspih.l" { - /* DSS: axis 1 polynomial coefficient. */ + // DSS: axis 1 polynomial coefficient. i = 1; dssflag = 3; -@@ -22879,9 +22876,9 @@ YY_RULE_SETUP +@@ -22879,9 +22840,9 @@ YY_RULE_SETUP YY_BREAK case 120: YY_RULE_SETUP -#line 1487 "wcspih.l" -+#line 1484 "wcspih.l" ++#line 1451 "wcspih.l" { - /* DSS: axis 2 polynomial coefficient. */ + // DSS: axis 2 polynomial coefficient. i = 2; dssflag = 3; -@@ -22891,9 +22888,9 @@ YY_RULE_SETUP +@@ -22891,9 +22852,9 @@ YY_RULE_SETUP YY_BREAK case 121: YY_RULE_SETUP -#line 1496 "wcspih.l" -+#line 1493 "wcspih.l" ++#line 1460 "wcspih.l" { - /* TNX or ZPX: string-encoded data array. */ + // TNX or ZPX: string-encoded data array. sscanf(yytext, "WAT%d_%d", &i, &m); if (watn < m) watn = m; watflag = 1; -@@ -22911,7 +22908,7 @@ YY_RULE_SETUP +@@ -22911,10 +22872,10 @@ YY_RULE_SETUP YY_BREAK case 122: YY_RULE_SETUP -#line 1513 "wcspih.l" -+#line 1510 "wcspih.l" ++#line 1477 "wcspih.l" { - if (wcspih_nkeyrec) { - wcspih_nkeyrec = 0; -@@ -22924,161 +22921,161 @@ YY_RULE_SETUP +- if (wcspih_nkeyrec) { +- wcspih_nkeyrec = 0; ++ if (yyextra->nkeyrec) { ++ yyextra->nkeyrec = 0; + errmsg = "keyrecords following the END keyrecord were ignored"; + BEGIN(ERROR); + } else { +@@ -22924,161 +22885,161 @@ YY_RULE_SETUP YY_BREAK case 123: YY_RULE_SETUP -#line 1523 "wcspih.l" -+#line 1520 "wcspih.l" ++#line 1487 "wcspih.l" { BEGIN(DISCARD); } YY_BREAK case 124: -#line 1528 "wcspih.l" -+#line 1525 "wcspih.l" ++#line 1492 "wcspih.l" case 125: -#line 1529 "wcspih.l" -+#line 1526 "wcspih.l" ++#line 1493 "wcspih.l" case 126: -#line 1530 "wcspih.l" -+#line 1527 "wcspih.l" ++#line 1494 "wcspih.l" case 127: YY_RULE_SETUP -#line 1530 "wcspih.l" -+#line 1527 "wcspih.l" ++#line 1494 "wcspih.l" { sscanf(yytext, "%d%c", &i, &a); BEGIN(VALUE); @@ -9368,26 +10591,26 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c YY_BREAK case 128: -#line 1536 "wcspih.l" -+#line 1533 "wcspih.l" ++#line 1500 "wcspih.l" case 129: -#line 1537 "wcspih.l" -+#line 1534 "wcspih.l" ++#line 1501 "wcspih.l" case 130: -#line 1538 "wcspih.l" -+#line 1535 "wcspih.l" ++#line 1502 "wcspih.l" case 131: -#line 1539 "wcspih.l" -+#line 1536 "wcspih.l" ++#line 1503 "wcspih.l" case 132: -#line 1540 "wcspih.l" -+#line 1537 "wcspih.l" ++#line 1504 "wcspih.l" case 133: -#line 1541 "wcspih.l" -+#line 1538 "wcspih.l" ++#line 1505 "wcspih.l" case 134: YY_RULE_SETUP -#line 1541 "wcspih.l" -+#line 1538 "wcspih.l" ++#line 1505 "wcspih.l" { if (relax & WCSHDR_reject) { - /* Violates the basic FITS standard. */ @@ -9405,32 +10628,32 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c YY_BREAK case 135: -#line 1555 "wcspih.l" -+#line 1552 "wcspih.l" ++#line 1519 "wcspih.l" case 136: -#line 1556 "wcspih.l" -+#line 1553 "wcspih.l" ++#line 1520 "wcspih.l" case 137: -#line 1557 "wcspih.l" -+#line 1554 "wcspih.l" ++#line 1521 "wcspih.l" case 138: -#line 1558 "wcspih.l" -+#line 1555 "wcspih.l" ++#line 1522 "wcspih.l" case 139: -#line 1559 "wcspih.l" -+#line 1556 "wcspih.l" ++#line 1523 "wcspih.l" case 140: -#line 1560 "wcspih.l" -+#line 1557 "wcspih.l" ++#line 1524 "wcspih.l" case 141: -#line 1561 "wcspih.l" -+#line 1558 "wcspih.l" ++#line 1525 "wcspih.l" case 142: -#line 1562 "wcspih.l" -+#line 1559 "wcspih.l" ++#line 1526 "wcspih.l" case 143: YY_RULE_SETUP -#line 1562 "wcspih.l" -+#line 1559 "wcspih.l" ++#line 1526 "wcspih.l" { - /* Anything that has fallen through to this point must contain */ - /* an invalid axis number. */ @@ -9443,7 +10666,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c case 144: YY_RULE_SETUP -#line 1569 "wcspih.l" -+#line 1566 "wcspih.l" ++#line 1533 "wcspih.l" { - /* Let it go. */ + // Let it go. @@ -9453,7 +10676,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c case 145: YY_RULE_SETUP -#line 1574 "wcspih.l" -+#line 1571 "wcspih.l" ++#line 1538 "wcspih.l" { if (relax & WCSHDR_reject) { - /* Looks too much like a FITS WCS keyword not to flag it. */ @@ -9472,17 +10695,17 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c YY_BREAK case 146: -#line 1589 "wcspih.l" -+#line 1586 "wcspih.l" ++#line 1553 "wcspih.l" case 147: -#line 1590 "wcspih.l" -+#line 1587 "wcspih.l" ++#line 1554 "wcspih.l" case 148: -#line 1591 "wcspih.l" -+#line 1588 "wcspih.l" ++#line 1555 "wcspih.l" case 149: YY_RULE_SETUP -#line 1591 "wcspih.l" -+#line 1588 "wcspih.l" ++#line 1555 "wcspih.l" { sscanf(yytext, "%d_%d%c", &i, &j, &a); BEGIN(VALUE); @@ -9490,72 +10713,72 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c YY_BREAK case 150: -#line 1598 "wcspih.l" -+#line 1595 "wcspih.l" ++#line 1562 "wcspih.l" case 151: -#line 1599 "wcspih.l" -+#line 1596 "wcspih.l" ++#line 1563 "wcspih.l" case 152: -#line 1600 "wcspih.l" -+#line 1597 "wcspih.l" ++#line 1564 "wcspih.l" case 153: -#line 1601 "wcspih.l" -+#line 1598 "wcspih.l" ++#line 1565 "wcspih.l" case 154: -#line 1602 "wcspih.l" -+#line 1599 "wcspih.l" ++#line 1566 "wcspih.l" case 155: -#line 1603 "wcspih.l" -+#line 1600 "wcspih.l" ++#line 1567 "wcspih.l" case 156: -#line 1604 "wcspih.l" -+#line 1601 "wcspih.l" ++#line 1568 "wcspih.l" case 157: -#line 1605 "wcspih.l" -+#line 1602 "wcspih.l" ++#line 1569 "wcspih.l" case 158: -#line 1606 "wcspih.l" -+#line 1603 "wcspih.l" ++#line 1570 "wcspih.l" case 159: -#line 1607 "wcspih.l" -+#line 1604 "wcspih.l" ++#line 1571 "wcspih.l" case 160: -#line 1608 "wcspih.l" -+#line 1605 "wcspih.l" ++#line 1572 "wcspih.l" case 161: -#line 1609 "wcspih.l" -+#line 1606 "wcspih.l" ++#line 1573 "wcspih.l" case 162: -#line 1610 "wcspih.l" -+#line 1607 "wcspih.l" ++#line 1574 "wcspih.l" case 163: -#line 1611 "wcspih.l" -+#line 1608 "wcspih.l" ++#line 1575 "wcspih.l" case 164: -#line 1612 "wcspih.l" -+#line 1609 "wcspih.l" ++#line 1576 "wcspih.l" case 165: -#line 1613 "wcspih.l" -+#line 1610 "wcspih.l" ++#line 1577 "wcspih.l" case 166: -#line 1614 "wcspih.l" -+#line 1611 "wcspih.l" ++#line 1578 "wcspih.l" case 167: -#line 1615 "wcspih.l" -+#line 1612 "wcspih.l" ++#line 1579 "wcspih.l" case 168: -#line 1616 "wcspih.l" -+#line 1613 "wcspih.l" ++#line 1580 "wcspih.l" case 169: -#line 1617 "wcspih.l" -+#line 1614 "wcspih.l" ++#line 1581 "wcspih.l" case 170: YY_RULE_SETUP -#line 1617 "wcspih.l" -+#line 1614 "wcspih.l" ++#line 1581 "wcspih.l" { if (((altlin == 1) && (relax & WCSHDR_PC0i_0ja)) || ((altlin == 2) && (relax & WCSHDR_CD0i_0ja))) { -@@ -23091,60 +23088,60 @@ YY_RULE_SETUP +@@ -23091,60 +23052,60 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -9567,35 +10790,35 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c YY_BREAK case 171: -#line 1635 "wcspih.l" -+#line 1632 "wcspih.l" ++#line 1599 "wcspih.l" case 172: -#line 1636 "wcspih.l" -+#line 1633 "wcspih.l" ++#line 1600 "wcspih.l" case 173: -#line 1637 "wcspih.l" -+#line 1634 "wcspih.l" ++#line 1601 "wcspih.l" case 174: -#line 1638 "wcspih.l" -+#line 1635 "wcspih.l" ++#line 1602 "wcspih.l" case 175: -#line 1639 "wcspih.l" -+#line 1636 "wcspih.l" ++#line 1603 "wcspih.l" case 176: -#line 1640 "wcspih.l" -+#line 1637 "wcspih.l" ++#line 1604 "wcspih.l" case 177: -#line 1641 "wcspih.l" -+#line 1638 "wcspih.l" ++#line 1605 "wcspih.l" case 178: -#line 1642 "wcspih.l" -+#line 1639 "wcspih.l" ++#line 1606 "wcspih.l" case 179: -#line 1643 "wcspih.l" -+#line 1640 "wcspih.l" ++#line 1607 "wcspih.l" case 180: YY_RULE_SETUP -#line 1643 "wcspih.l" -+#line 1640 "wcspih.l" ++#line 1607 "wcspih.l" { - /* Anything that has fallen through to this point must contain */ - /* an invalid axis number. */ @@ -9607,51 +10830,51 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c YY_BREAK case 181: -#line 1651 "wcspih.l" -+#line 1648 "wcspih.l" ++#line 1615 "wcspih.l" case 182: -#line 1652 "wcspih.l" -+#line 1649 "wcspih.l" ++#line 1616 "wcspih.l" case 183: -#line 1653 "wcspih.l" -+#line 1650 "wcspih.l" ++#line 1617 "wcspih.l" case 184: -#line 1654 "wcspih.l" -+#line 1651 "wcspih.l" ++#line 1618 "wcspih.l" case 185: -#line 1655 "wcspih.l" -+#line 1652 "wcspih.l" ++#line 1619 "wcspih.l" case 186: -#line 1656 "wcspih.l" -+#line 1653 "wcspih.l" ++#line 1620 "wcspih.l" case 187: -#line 1657 "wcspih.l" -+#line 1654 "wcspih.l" ++#line 1621 "wcspih.l" case 188: -#line 1658 "wcspih.l" -+#line 1655 "wcspih.l" ++#line 1622 "wcspih.l" case 189: -#line 1659 "wcspih.l" -+#line 1656 "wcspih.l" ++#line 1623 "wcspih.l" case 190: YY_RULE_SETUP -#line 1659 "wcspih.l" -+#line 1656 "wcspih.l" ++#line 1623 "wcspih.l" { errmsg = errtxt; sprintf(errmsg, "%s keyword must use an underscore, not a dash", -@@ -23154,9 +23151,9 @@ YY_RULE_SETUP +@@ -23154,9 +23115,9 @@ YY_RULE_SETUP YY_BREAK case 191: YY_RULE_SETUP -#line 1666 "wcspih.l" -+#line 1663 "wcspih.l" ++#line 1630 "wcspih.l" { - /* This covers the defunct forms CD00i00j and PC00i00j. */ + // This covers the defunct forms CD00i00j and PC00i00j. if (((altlin == 1) && (relax & WCSHDR_PC00i00j)) || ((altlin == 2) && (relax & WCSHDR_CD00i00j))) { sscanf(yytext, "%3d%3d", &i, &j); -@@ -23171,23 +23168,23 @@ YY_RULE_SETUP +@@ -23171,23 +23132,23 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -9664,27 +10887,27 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c case 192: YY_RULE_SETUP -#line 1687 "wcspih.l" -+#line 1684 "wcspih.l" ++#line 1651 "wcspih.l" { BEGIN(DISCARD); } YY_BREAK case 193: -#line 1692 "wcspih.l" -+#line 1689 "wcspih.l" ++#line 1656 "wcspih.l" case 194: YY_RULE_SETUP -#line 1692 "wcspih.l" -+#line 1689 "wcspih.l" ++#line 1656 "wcspih.l" { if (YY_START == CCCCCCCa) { sscanf(yytext, "%c", &a); -@@ -23201,78 +23198,78 @@ YY_RULE_SETUP +@@ -23201,78 +23162,78 @@ YY_RULE_SETUP YY_BREAK case 195: YY_RULE_SETUP -#line 1703 "wcspih.l" -+#line 1700 "wcspih.l" ++#line 1667 "wcspih.l" { if (relax & WCSHDR_reject) { - /* Looks too much like a FITS WCS keyword not to flag it. */ @@ -9703,17 +10926,17 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c YY_BREAK case 196: -#line 1718 "wcspih.l" -+#line 1715 "wcspih.l" ++#line 1682 "wcspih.l" case 197: -#line 1719 "wcspih.l" -+#line 1716 "wcspih.l" ++#line 1683 "wcspih.l" case 198: -#line 1720 "wcspih.l" -+#line 1717 "wcspih.l" ++#line 1684 "wcspih.l" case 199: YY_RULE_SETUP -#line 1720 "wcspih.l" -+#line 1717 "wcspih.l" ++#line 1684 "wcspih.l" { sscanf(yytext, "%d_%d%c", &i, &m, &a); BEGIN(VALUE); @@ -9721,72 +10944,72 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c YY_BREAK case 200: -#line 1726 "wcspih.l" -+#line 1723 "wcspih.l" ++#line 1690 "wcspih.l" case 201: -#line 1727 "wcspih.l" -+#line 1724 "wcspih.l" ++#line 1691 "wcspih.l" case 202: -#line 1728 "wcspih.l" -+#line 1725 "wcspih.l" ++#line 1692 "wcspih.l" case 203: -#line 1729 "wcspih.l" -+#line 1726 "wcspih.l" ++#line 1693 "wcspih.l" case 204: -#line 1730 "wcspih.l" -+#line 1727 "wcspih.l" ++#line 1694 "wcspih.l" case 205: -#line 1731 "wcspih.l" -+#line 1728 "wcspih.l" ++#line 1695 "wcspih.l" case 206: -#line 1732 "wcspih.l" -+#line 1729 "wcspih.l" ++#line 1696 "wcspih.l" case 207: -#line 1733 "wcspih.l" -+#line 1730 "wcspih.l" ++#line 1697 "wcspih.l" case 208: -#line 1734 "wcspih.l" -+#line 1731 "wcspih.l" ++#line 1698 "wcspih.l" case 209: -#line 1735 "wcspih.l" -+#line 1732 "wcspih.l" ++#line 1699 "wcspih.l" case 210: -#line 1736 "wcspih.l" -+#line 1733 "wcspih.l" ++#line 1700 "wcspih.l" case 211: -#line 1737 "wcspih.l" -+#line 1734 "wcspih.l" ++#line 1701 "wcspih.l" case 212: -#line 1738 "wcspih.l" -+#line 1735 "wcspih.l" ++#line 1702 "wcspih.l" case 213: -#line 1739 "wcspih.l" -+#line 1736 "wcspih.l" ++#line 1703 "wcspih.l" case 214: -#line 1740 "wcspih.l" -+#line 1737 "wcspih.l" ++#line 1704 "wcspih.l" case 215: -#line 1741 "wcspih.l" -+#line 1738 "wcspih.l" ++#line 1705 "wcspih.l" case 216: -#line 1742 "wcspih.l" -+#line 1739 "wcspih.l" ++#line 1706 "wcspih.l" case 217: -#line 1743 "wcspih.l" -+#line 1740 "wcspih.l" ++#line 1707 "wcspih.l" case 218: -#line 1744 "wcspih.l" -+#line 1741 "wcspih.l" ++#line 1708 "wcspih.l" case 219: -#line 1745 "wcspih.l" -+#line 1742 "wcspih.l" ++#line 1709 "wcspih.l" case 220: YY_RULE_SETUP -#line 1745 "wcspih.l" -+#line 1742 "wcspih.l" ++#line 1709 "wcspih.l" { if (((valtype == FLOAT) && (relax & WCSHDR_PV0i_0ma)) || ((valtype == STRING) && (relax & WCSHDR_PS0i_0ma))) { -@@ -23285,60 +23282,60 @@ YY_RULE_SETUP +@@ -23285,60 +23246,60 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -9798,35 +11021,35 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c YY_BREAK case 221: -#line 1763 "wcspih.l" -+#line 1760 "wcspih.l" ++#line 1727 "wcspih.l" case 222: -#line 1764 "wcspih.l" -+#line 1761 "wcspih.l" ++#line 1728 "wcspih.l" case 223: -#line 1765 "wcspih.l" -+#line 1762 "wcspih.l" ++#line 1729 "wcspih.l" case 224: -#line 1766 "wcspih.l" -+#line 1763 "wcspih.l" ++#line 1730 "wcspih.l" case 225: -#line 1767 "wcspih.l" -+#line 1764 "wcspih.l" ++#line 1731 "wcspih.l" case 226: -#line 1768 "wcspih.l" -+#line 1765 "wcspih.l" ++#line 1732 "wcspih.l" case 227: -#line 1769 "wcspih.l" -+#line 1766 "wcspih.l" ++#line 1733 "wcspih.l" case 228: -#line 1770 "wcspih.l" -+#line 1767 "wcspih.l" ++#line 1734 "wcspih.l" case 229: -#line 1771 "wcspih.l" -+#line 1768 "wcspih.l" ++#line 1735 "wcspih.l" case 230: YY_RULE_SETUP -#line 1771 "wcspih.l" -+#line 1768 "wcspih.l" ++#line 1735 "wcspih.l" { - /* Anything that has fallen through to this point must contain */ - /* an invalid axis number. */ @@ -9838,62 +11061,62 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c YY_BREAK case 231: -#line 1779 "wcspih.l" -+#line 1776 "wcspih.l" ++#line 1743 "wcspih.l" case 232: -#line 1780 "wcspih.l" -+#line 1777 "wcspih.l" ++#line 1744 "wcspih.l" case 233: -#line 1781 "wcspih.l" -+#line 1778 "wcspih.l" ++#line 1745 "wcspih.l" case 234: -#line 1782 "wcspih.l" -+#line 1779 "wcspih.l" ++#line 1746 "wcspih.l" case 235: -#line 1783 "wcspih.l" -+#line 1780 "wcspih.l" ++#line 1747 "wcspih.l" case 236: -#line 1784 "wcspih.l" -+#line 1781 "wcspih.l" ++#line 1748 "wcspih.l" case 237: -#line 1785 "wcspih.l" -+#line 1782 "wcspih.l" ++#line 1749 "wcspih.l" case 238: -#line 1786 "wcspih.l" -+#line 1783 "wcspih.l" ++#line 1750 "wcspih.l" case 239: -#line 1787 "wcspih.l" -+#line 1784 "wcspih.l" ++#line 1751 "wcspih.l" case 240: YY_RULE_SETUP -#line 1787 "wcspih.l" -+#line 1784 "wcspih.l" ++#line 1751 "wcspih.l" { errmsg = errtxt; sprintf(errmsg, "%s keyword must use an underscore, not a dash", -@@ -23348,18 +23345,18 @@ YY_RULE_SETUP +@@ -23348,18 +23309,18 @@ YY_RULE_SETUP YY_BREAK case 241: YY_RULE_SETUP -#line 1794 "wcspih.l" -+#line 1791 "wcspih.l" ++#line 1758 "wcspih.l" { BEGIN(DISCARD); } YY_BREAK case 242: -#line 1799 "wcspih.l" -+#line 1796 "wcspih.l" ++#line 1763 "wcspih.l" case 243: -#line 1800 "wcspih.l" -+#line 1797 "wcspih.l" ++#line 1764 "wcspih.l" case 244: YY_RULE_SETUP -#line 1800 "wcspih.l" -+#line 1797 "wcspih.l" ++#line 1764 "wcspih.l" { a = ' '; sscanf(yytext, "%d%c", &i, &a); -@@ -23377,14 +23374,14 @@ YY_RULE_SETUP +@@ -23377,14 +23338,14 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -9906,97 +11129,97 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c case 245: YY_RULE_SETUP -#line 1822 "wcspih.l" -+#line 1819 "wcspih.l" ++#line 1786 "wcspih.l" { yyless(0); BEGIN(CCCCCia); -@@ -23392,7 +23389,7 @@ YY_RULE_SETUP +@@ -23392,7 +23353,7 @@ YY_RULE_SETUP YY_BREAK case 246: YY_RULE_SETUP -#line 1827 "wcspih.l" -+#line 1824 "wcspih.l" ++#line 1791 "wcspih.l" { if (relax & WCSHDR_PROJPn) { sscanf(yytext, "%d", &m); -@@ -23410,10 +23407,10 @@ YY_RULE_SETUP +@@ -23410,10 +23371,10 @@ YY_RULE_SETUP } YY_BREAK case 247: -#line 1844 "wcspih.l" -+#line 1841 "wcspih.l" ++#line 1808 "wcspih.l" case 248: YY_RULE_SETUP -#line 1844 "wcspih.l" -+#line 1841 "wcspih.l" ++#line 1808 "wcspih.l" { if (relax & (WCSHDR_PROJPn | WCSHDR_reject)) { errmsg = "invalid PROJPn keyword"; -@@ -23426,18 +23423,18 @@ YY_RULE_SETUP +@@ -23426,18 +23387,18 @@ YY_RULE_SETUP YY_BREAK case 249: YY_RULE_SETUP -#line 1854 "wcspih.l" -+#line 1851 "wcspih.l" ++#line 1818 "wcspih.l" { BEGIN(DISCARD); } YY_BREAK case 250: -#line 1859 "wcspih.l" -+#line 1856 "wcspih.l" ++#line 1823 "wcspih.l" case 251: YY_RULE_SETUP -#line 1859 "wcspih.l" -+#line 1856 "wcspih.l" ++#line 1823 "wcspih.l" { - /* SIP keywords. */ + // SIP keywords. valtype = FLOAT; distype = PRIOR; vptr = &(distem.dp); -@@ -23451,21 +23448,21 @@ YY_RULE_SETUP +@@ -23451,21 +23412,21 @@ YY_RULE_SETUP } YY_BREAK case 252: -#line 1874 "wcspih.l" -+#line 1871 "wcspih.l" ++#line 1838 "wcspih.l" case 253: YY_RULE_SETUP -#line 1874 "wcspih.l" -+#line 1871 "wcspih.l" ++#line 1838 "wcspih.l" { BEGIN(DISCARD); } YY_BREAK case 254: -#line 1879 "wcspih.l" -+#line 1876 "wcspih.l" ++#line 1843 "wcspih.l" case 255: YY_RULE_SETUP -#line 1879 "wcspih.l" -+#line 1876 "wcspih.l" ++#line 1843 "wcspih.l" { - /* DSS keywords. */ + // DSS keywords. valtype = FLOAT; distype = SEQUENT; vptr = &(distem.dp); -@@ -23480,7 +23477,7 @@ YY_RULE_SETUP +@@ -23480,7 +23441,7 @@ YY_RULE_SETUP YY_BREAK case 256: YY_RULE_SETUP -#line 1893 "wcspih.l" -+#line 1890 "wcspih.l" ++#line 1857 "wcspih.l" { BEGIN(DISCARD); } -@@ -23488,11 +23485,11 @@ YY_RULE_SETUP +@@ -23488,11 +23449,11 @@ YY_RULE_SETUP case 257: /* rule 257 can match eol */ YY_RULE_SETUP -#line 1897 "wcspih.l" -+#line 1894 "wcspih.l" ++#line 1861 "wcspih.l" { - /* Special handling for this iconic DSS keyword. */ + // Special handling for this iconic DSS keyword. @@ -10006,12 +11229,12 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c sscanf(yytext, "= '%s", strtmp); dbltmp = strcmp(strtmp, "-") ? 1.0 : -1.0; } -@@ -23502,16 +23499,16 @@ YY_RULE_SETUP +@@ -23502,16 +23463,16 @@ YY_RULE_SETUP YY_BREAK case 258: YY_RULE_SETUP -#line 1908 "wcspih.l" -+#line 1905 "wcspih.l" ++#line 1872 "wcspih.l" { BEGIN(DISCARD); } @@ -10019,14 +11242,14 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c case 259: YY_RULE_SETUP -#line 1912 "wcspih.l" -+#line 1909 "wcspih.l" ++#line 1876 "wcspih.l" { - /* Do checks on i, j & m. */ + // Do checks on i, j & m. if (99 < i || 99 < j || 99 < m) { if (relax & WCSHDR_reject) { if (99 < i || 99 < j) { -@@ -23522,7 +23519,7 @@ YY_RULE_SETUP +@@ -23522,7 +23483,7 @@ YY_RULE_SETUP BEGIN(ERROR); } else { @@ -10035,21 +11258,21 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c BEGIN(DISCARD); } -@@ -23548,7 +23545,7 @@ YY_RULE_SETUP +@@ -23548,7 +23509,7 @@ YY_RULE_SETUP YY_BREAK case 260: YY_RULE_SETUP -#line 1948 "wcspih.l" -+#line 1945 "wcspih.l" ++#line 1912 "wcspih.l" { errmsg = "invalid KEYWORD = VALUE syntax"; BEGIN(ERROR); -@@ -23556,13 +23553,13 @@ YY_RULE_SETUP +@@ -23556,13 +23517,13 @@ YY_RULE_SETUP YY_BREAK case 261: YY_RULE_SETUP -#line 1953 "wcspih.l" -+#line 1950 "wcspih.l" ++#line 1917 "wcspih.l" { if (ipass == 1) { BEGIN(COMMENT); @@ -10060,21 +11283,21 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c sscanf(yytext, "%d", &inttmp); BEGIN(COMMENT); -@@ -23571,7 +23568,7 @@ YY_RULE_SETUP +@@ -23571,7 +23532,7 @@ YY_RULE_SETUP YY_BREAK case 262: YY_RULE_SETUP -#line 1965 "wcspih.l" -+#line 1962 "wcspih.l" ++#line 1929 "wcspih.l" { errmsg = "an integer value was expected"; BEGIN(ERROR); -@@ -23579,13 +23576,13 @@ YY_RULE_SETUP +@@ -23579,13 +23540,13 @@ YY_RULE_SETUP YY_BREAK case 263: YY_RULE_SETUP -#line 1970 "wcspih.l" -+#line 1967 "wcspih.l" ++#line 1934 "wcspih.l" { if (ipass == 1) { BEGIN(COMMENT); @@ -10085,21 +11308,21 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c wcsutil_str2double(yytext, &dbltmp); if (chekval && chekval(dbltmp)) { -@@ -23599,7 +23596,7 @@ YY_RULE_SETUP +@@ -23599,7 +23560,7 @@ YY_RULE_SETUP YY_BREAK case 264: YY_RULE_SETUP -#line 1987 "wcspih.l" -+#line 1984 "wcspih.l" ++#line 1951 "wcspih.l" { errmsg = "a floating-point value was expected"; BEGIN(ERROR); -@@ -23607,13 +23604,13 @@ YY_RULE_SETUP +@@ -23607,13 +23568,13 @@ YY_RULE_SETUP YY_BREAK case 265: YY_RULE_SETUP -#line 1992 "wcspih.l" -+#line 1989 "wcspih.l" ++#line 1956 "wcspih.l" { if (ipass == 1) { BEGIN(COMMENT); @@ -10110,21 +11333,21 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c wcsutil_str2double2(yytext, dbl2tmp); BEGIN(COMMENT); -@@ -23622,7 +23619,7 @@ YY_RULE_SETUP +@@ -23622,7 +23583,7 @@ YY_RULE_SETUP YY_BREAK case 266: YY_RULE_SETUP -#line 2004 "wcspih.l" -+#line 2001 "wcspih.l" ++#line 1968 "wcspih.l" { errmsg = "a floating-point value was expected"; BEGIN(ERROR); -@@ -23631,16 +23628,16 @@ YY_RULE_SETUP +@@ -23631,18 +23592,18 @@ YY_RULE_SETUP case 267: /* rule 267 can match eol */ YY_RULE_SETUP -#line 2009 "wcspih.l" -+#line 2006 "wcspih.l" ++#line 1973 "wcspih.l" { if (ipass == 1) { BEGIN(COMMENT); @@ -10135,61 +11358,65 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c strcpy(strtmp, yytext+1); - /* Squeeze out repeated quotes. */ +- ix = 0; +- for (jx = 0; jx < 72; jx++) { + // Squeeze out repeated quotes. - ix = 0; - for (jx = 0; jx < 72; jx++) { ++ int ix = 0; ++ for (int jx = 0; jx < 72; jx++) { if (ix < jx) { -@@ -23663,7 +23660,7 @@ YY_RULE_SETUP + strtmp[ix] = strtmp[jx]; + } +@@ -23663,7 +23624,7 @@ YY_RULE_SETUP YY_BREAK case 268: YY_RULE_SETUP -#line 2038 "wcspih.l" -+#line 2035 "wcspih.l" ++#line 2002 "wcspih.l" { errmsg = "a string value was expected"; BEGIN(ERROR); -@@ -23672,7 +23669,7 @@ YY_RULE_SETUP +@@ -23672,7 +23633,7 @@ YY_RULE_SETUP case 269: /* rule 269 can match eol */ YY_RULE_SETUP -#line 2043 "wcspih.l" -+#line 2040 "wcspih.l" ++#line 2007 "wcspih.l" { if (ipass == 1) { BEGIN(COMMENT); -@@ -23686,7 +23683,7 @@ YY_RULE_SETUP +@@ -23686,7 +23647,7 @@ YY_RULE_SETUP YY_BREAK case 270: YY_RULE_SETUP -#line 2054 "wcspih.l" -+#line 2051 "wcspih.l" ++#line 2018 "wcspih.l" { errmsg = "a record was expected"; BEGIN(ERROR); -@@ -23694,7 +23691,7 @@ YY_RULE_SETUP +@@ -23694,7 +23655,7 @@ YY_RULE_SETUP YY_BREAK case 271: YY_RULE_SETUP -#line 2059 "wcspih.l" -+#line 2056 "wcspih.l" ++#line 2023 "wcspih.l" { strcpy(strtmp, yytext); BEGIN(RECCOLON); -@@ -23702,7 +23699,7 @@ YY_RULE_SETUP +@@ -23702,7 +23663,7 @@ YY_RULE_SETUP YY_BREAK case 272: YY_RULE_SETUP -#line 2064 "wcspih.l" -+#line 2061 "wcspih.l" ++#line 2028 "wcspih.l" { errmsg = "invalid record field"; BEGIN(ERROR); -@@ -23710,14 +23707,14 @@ YY_RULE_SETUP +@@ -23710,14 +23671,14 @@ YY_RULE_SETUP YY_BREAK case 273: YY_RULE_SETUP -#line 2069 "wcspih.l" -+#line 2066 "wcspih.l" ++#line 2033 "wcspih.l" { BEGIN(RECVALUE); } @@ -10197,52 +11424,52 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c case 274: YY_RULE_SETUP -#line 2073 "wcspih.l" -+#line 2070 "wcspih.l" ++#line 2037 "wcspih.l" { errmsg = "invalid record syntax"; BEGIN(ERROR); -@@ -23725,7 +23722,7 @@ YY_RULE_SETUP +@@ -23725,7 +23686,7 @@ YY_RULE_SETUP YY_BREAK case 275: YY_RULE_SETUP -#line 2078 "wcspih.l" -+#line 2075 "wcspih.l" ++#line 2042 "wcspih.l" { rectype = 0; sscanf(yytext, "%d", &inttmp); -@@ -23734,7 +23731,7 @@ YY_RULE_SETUP +@@ -23734,7 +23695,7 @@ YY_RULE_SETUP YY_BREAK case 276: YY_RULE_SETUP -#line 2084 "wcspih.l" -+#line 2081 "wcspih.l" ++#line 2048 "wcspih.l" { rectype = 1; wcsutil_str2double(yytext, &dbltmp); -@@ -23743,7 +23740,7 @@ YY_RULE_SETUP +@@ -23743,7 +23704,7 @@ YY_RULE_SETUP YY_BREAK case 277: YY_RULE_SETUP -#line 2090 "wcspih.l" -+#line 2087 "wcspih.l" ++#line 2054 "wcspih.l" { errmsg = "invalid record value"; BEGIN(ERROR); -@@ -23751,7 +23748,7 @@ YY_RULE_SETUP +@@ -23751,7 +23712,7 @@ YY_RULE_SETUP YY_BREAK case 278: YY_RULE_SETUP -#line 2095 "wcspih.l" -+#line 2092 "wcspih.l" ++#line 2059 "wcspih.l" { BEGIN(COMMENT); } -@@ -23761,19 +23758,19 @@ case 279: +@@ -23761,19 +23722,19 @@ case 279: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 2099 "wcspih.l" -+#line 2096 "wcspih.l" ++#line 2063 "wcspih.l" { if (ipass == 1) { - /* Do first-pass bookkeeping. */ @@ -10252,31 +11479,36 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c } else if (*wcs) { - /* Store the value now that the keyrecord has been validated. */ -+ // Store the value now that the keyrecord has been validated. - gotone = 0; - for (ialt = 0; ialt < *nwcs; ialt++) { +- gotone = 0; +- for (ialt = 0; ialt < *nwcs; ialt++) { - /* The loop here is for keywords that apply */ - /* to every alternate; these have a == 0. */ ++ // Store the value now that the keyrecord has been validated. ++ int gotone = 0; ++ for (int ialt = 0; ialt < *nwcs; ialt++) { + // The loop here is for keywords that apply + // to every alternate; these have a == 0. if (a >= 'A') { ialt = alts[a-'A'+1]; if (ialt < 0) break; -@@ -23782,11 +23779,11 @@ YY_RULE_SETUP +@@ -23782,11 +23743,12 @@ YY_RULE_SETUP if (vptr) { if (sipflag) { - /* Translate a SIP keyword into DPja. */ +- disp = (*wcs)->lin.dispre; +- ipx = (disp->ndp)++; + // Translate a SIP keyword into DPja. - disp = (*wcs)->lin.dispre; - ipx = (disp->ndp)++; ++ struct disprm *disp = (*wcs)->lin.dispre; ++ int ipx = (disp->ndp)++; - /* SIP doesn't have alternates. */ + // SIP doesn't have alternates. ++ char keyword[16]; sprintf(keyword, "DP%d", i); sprintf(strtmp, "SIP.%s.%d_%d", (sipflag==2)?"FWD":"REV", p, q); -@@ -23797,27 +23794,27 @@ YY_RULE_SETUP +@@ -23797,27 +23759,28 @@ YY_RULE_SETUP } } else if (dssflag) { @@ -10296,11 +11528,14 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c - /* Translate a DSS keyword into DQia. */ + // Translate a DSS keyword into DQia. if (m <= 13 || dbltmp != 0.0) { - disp = (*wcs)->lin.disseq; - ipx = (disp->ndp)++; +- disp = (*wcs)->lin.disseq; +- ipx = (disp->ndp)++; ++ struct disprm *disp = (*wcs)->lin.disseq; ++ int ipx = (disp->ndp)++; - /* DSS doesn't have alternates. */ + // DSS doesn't have alternates. ++ char keyword[16]; sprintf(keyword, "DQ%d", i); sprintf(strtmp, "DSS.AMD.%d", m); dpfill(disp->dp+ipx, keyword, strtmp, i, 1, 0, dbltmp); @@ -10310,7 +11545,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c if (m <= 3) { dsstmp[13+(i-1)*3+m] = dbltmp; } -@@ -23825,32 +23822,32 @@ YY_RULE_SETUP +@@ -23825,32 +23788,35 @@ YY_RULE_SETUP } } else if (watflag) { @@ -10320,12 +11555,17 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c } else { - /* An "ordinary" keyword. */ +- wcsp = *wcs + ialt; + // An "ordinary" keyword. - wcsp = *wcs + ialt; ++ struct wcsprm *wcsp = *wcs + ialt; ++ struct disprm *disp; ++ void *wptr; ++ ptrdiff_t voff; if (auxprm) { - /* Additional auxiliary parameter. */ +- auxp = wcsp->aux; + // Additional auxiliary parameter. - auxp = wcsp->aux; ++ struct auxprm *auxp = wcsp->aux; voff = (char *)vptr - (char *)(&auxtem); wptr = (void *)((char *)auxp + voff); @@ -10350,16 +11590,19 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c voff = (char *)vptr - (char *)(&wcstem); wptr = (void *)((char *)wcsp + voff); } -@@ -23859,7 +23856,7 @@ YY_RULE_SETUP +@@ -23859,9 +23825,9 @@ YY_RULE_SETUP *((int *)wptr) = inttmp; } else if (valtype == FLOAT) { - /* Apply keyword parameterization. */ + // Apply keyword parameterization. if (npptr == npv) { - ipx = (wcsp->npv)++; +- ipx = (wcsp->npv)++; ++ int ipx = (wcsp->npv)++; wcsp->pv[ipx].i = i; -@@ -23880,14 +23877,14 @@ YY_RULE_SETUP + wcsp->pv[ipx].m = m; + wptr = &(wcsp->pv[ipx].value); +@@ -23880,14 +23846,14 @@ YY_RULE_SETUP *((double *)wptr) = dbltmp; } @@ -10376,57 +11619,85 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c if (special) { special(wptr, dbl2tmp); } else { -@@ -23896,7 +23893,7 @@ YY_RULE_SETUP +@@ -23896,9 +23862,9 @@ YY_RULE_SETUP } } else if (valtype == STRING) { - /* Apply keyword parameterization. */ + // Apply keyword parameterization. if (npptr == nps) { - ipx = (wcsp->nps)++; +- ipx = (wcsp->nps)++; ++ int ipx = (wcsp->nps)++; wcsp->ps[ipx].i = i; -@@ -23961,7 +23958,7 @@ case 280: + wcsp->ps[ipx].m = m; + wptr = wcsp->ps[ipx].value; +@@ -23911,12 +23877,13 @@ YY_RULE_SETUP + wptr = *((char (**)[72])wptr) + (i - 1); + } + +- cptr = (char *)wptr; ++ char *cptr = (char *)wptr; + strcpy(cptr, strtmp); + + } else if (valtype == RECORD) { +- ipx = (disp->ndp)++; ++ int ipx = (disp->ndp)++; + ++ char keyword[16]; + if (a == ' ') { + sprintf(keyword, "%.2s%d", keyname, i); + } else { +@@ -23937,7 +23904,7 @@ YY_RULE_SETUP + if (ctrl == 4) { + if (distran || dssflag) { + wcsfprintf(stderr, "%.80s\n Accepted (%d) as a " +- "recognised WCS convention.\n", keyrec, nvalid); ++ "recognized WCS convention.\n", keyrec, nvalid); + } else { + wcsfprintf(stderr, "%.80s\n Accepted (%d) as a " + "valid WCS keyrecord.\n", keyrec, nvalid); +@@ -23961,7 +23928,7 @@ case 280: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 2293 "wcspih.l" -+#line 2290 "wcspih.l" ++#line 2263 "wcspih.l" { errmsg = "invalid keyvalue"; BEGIN(ERROR); -@@ -23972,7 +23969,7 @@ case 281: +@@ -23972,7 +23939,7 @@ case 281: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 2298 "wcspih.l" -+#line 2295 "wcspih.l" ++#line 2268 "wcspih.l" { errmsg = "invalid keyvalue"; BEGIN(ERROR); -@@ -23983,7 +23980,7 @@ case 282: +@@ -23983,7 +23950,7 @@ case 282: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 2303 "wcspih.l" -+#line 2300 "wcspih.l" ++#line 2273 "wcspih.l" { errmsg = "invalid keyvalue or malformed keycomment"; BEGIN(ERROR); -@@ -23994,7 +23991,7 @@ case 283: +@@ -23994,7 +23961,7 @@ case 283: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 2308 "wcspih.l" -+#line 2305 "wcspih.l" ++#line 2278 "wcspih.l" { errmsg = "malformed keycomment"; BEGIN(ERROR); -@@ -24005,11 +24002,11 @@ case 284: +@@ -24005,11 +23972,11 @@ case 284: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 2313 "wcspih.l" -+#line 2310 "wcspih.l" ++#line 2283 "wcspih.l" { if (ipass == npass) { if (ctrl < 0) { @@ -10435,12 +11706,12 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c keep = keyrec; } else if (2 < ctrl) { -@@ -24026,13 +24023,13 @@ case 285: +@@ -24026,13 +23993,13 @@ case 285: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 2328 "wcspih.l" -+#line 2325 "wcspih.l" ++#line 2298 "wcspih.l" { if (ipass == npass) { (*nreject)++; @@ -10451,16 +11722,16 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c keep = keyrec; } -@@ -24047,7 +24044,7 @@ YY_RULE_SETUP +@@ -24047,7 +24014,7 @@ YY_RULE_SETUP case 286: /* rule 286 can match eol */ YY_RULE_SETUP -#line 2345 "wcspih.l" -+#line 2342 "wcspih.l" ++#line 2315 "wcspih.l" { if (ipass == npass && keep) { if (hptr < keep) { -@@ -24058,7 +24055,7 @@ YY_RULE_SETUP +@@ -24058,7 +24025,7 @@ YY_RULE_SETUP naux += auxprm; @@ -10469,52 +11740,105 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c i = j = 0; m = 0; a = ' '; -@@ -24109,9 +24106,9 @@ case YY_STATE_EOF(COMMENT): +@@ -24109,9 +24076,10 @@ case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(DISCARD): case YY_STATE_EOF(ERROR): case YY_STATE_EOF(FLUSH): -#line 2379 "wcspih.l" -+#line 2376 "wcspih.l" ++#line 2349 "wcspih.l" { - /* End-of-input. */ + // End-of-input. ++ int status; if (ipass == 1) { if ((status = wcspih_init1(naxis, alts, dpq, npv, nps, ndp, ndq, naux, distran, nwcs, wcs)) || -@@ -24185,10 +24182,10 @@ case YY_STATE_EOF(FLUSH): +@@ -24136,8 +24104,8 @@ case YY_STATE_EOF(FLUSH): + } + + if (ipass++ < npass) { +- wcspih_hdr = header; +- wcspih_nkeyrec = nkeyrec; ++ yyextra->hdr = header; ++ yyextra->nkeyrec = nkeyrec; + keyrec = header; + *nreject = 0; + +@@ -24185,10 +24153,10 @@ case YY_STATE_EOF(FLUSH): YY_BREAK case 287: YY_RULE_SETUP -#line 2452 "wcspih.l" -+#line 2449 "wcspih.l" ++#line 2423 "wcspih.l" ECHO; YY_BREAK -#line 24192 "wcspih.c" -+#line 24189 "wcspih.c" ++#line 24160 "wcspih.c" case YY_END_OF_BUFFER: { -@@ -25353,7 +25350,7 @@ void yyfree (void * ptr , yyscan_t yysca +@@ -25353,7 +25321,36 @@ void yyfree (void * ptr , yyscan_t yysca #define YYTABLES_NAME "yytables" -#line 2452 "wcspih.l" -+#line 2449 "wcspih.l" ++#line 2423 "wcspih.l" ++ ++ ++/*---------------------------------------------------------------------------- ++* External interface to the scanner. ++*---------------------------------------------------------------------------*/ ++ ++int wcspih( ++ char *header, ++ int nkeyrec, ++ int relax, ++ int ctrl, ++ int *nreject, ++ int *nwcs, ++ struct wcsprm **wcs) ++ ++{ ++ // Function prototypes. ++ int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner); ++ int yylex_destroy(yyscan_t yyscanner); ++ ++ struct wcspih_extra extra; ++ yyscan_t yyscanner; ++ yylex_init_extra(&extra, &yyscanner); ++ int status = wcspih_scanner(header, nkeyrec, relax, ctrl, nreject, nwcs, ++ wcs, yyscanner); ++ yylex_destroy(yyscanner); ++ ++ return status; ++} /*---------------------------------------------------------------------------- -@@ -25373,8 +25370,8 @@ void wcspih_pass1( +@@ -25373,26 +25370,24 @@ void wcspih_pass1( int *npptr) { - /* On the first pass alts[] is used to determine the number of axes */ - /* for each of the 27 possible alternate coordinate descriptions. */ +- int ialt, *ip; +- + // On the first pass alts[] is used to determine the number of axes + // for each of the 27 possible alternate coordinate descriptions. - int ialt, *ip; - if (a == 0) { -@@ -25392,7 +25389,7 @@ void wcspih_pass1( + return; + } + +- ialt = 0; ++ int ialt = 0; + if (a != ' ') { + ialt = a - 'A' + 1; + } + +- ip = alts + ialt; ++ int *ip = alts + ialt; + + if (*ip < naxis) { *ip = naxis; } @@ -10523,7 +11847,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c if (*ip < i) { *ip = i; } -@@ -25401,10 +25398,10 @@ void wcspih_pass1( +@@ -25401,10 +25396,10 @@ void wcspih_pass1( *ip = j; } @@ -10536,17 +11860,24 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c if (npptr) { npptr[ialt]++; } -@@ -25434,37 +25431,37 @@ int wcspih_init1( - struct wcsprm *wcsp; - struct disprm *dis; +@@ -25430,115 +25425,115 @@ int wcspih_init1( + struct wcsprm **wcs) + + { +- int ialt, defaults, ndis, ndpmax, npsmax, npvmax, status = 0; +- struct wcsprm *wcsp; +- struct disprm *dis; ++ int status = 0; - /* Find the number of coordinate descriptions. */ + // Find the number of coordinate descriptions. *nwcs = 0; - for (ialt = 0; ialt < 27; ialt++) { +- for (ialt = 0; ialt < 27; ialt++) { ++ for (int ialt = 0; ialt < 27; ialt++) { if (alts[ialt]) (*nwcs)++; } ++ int defaults; if ((defaults = !(*nwcs) && naxis)) { - /* NAXIS is non-zero but there were no WCS keywords with an alternate - version code; create a default WCS with blank alternate version. */ @@ -10563,7 +11894,8 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c return WCSHDRERR_MEMORY; } - ndis = 0; +- ndis = 0; ++ int ndis = 0; if (distran == SIP) { - /* DPja.NAXES and DPja.OFFSET.j to be added for SIP (see below and - wcspih_final()). */ @@ -10578,11 +11910,20 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c } - /* Initialize each wcsprm struct. */ +- wcsp = *wcs; + // Initialize each wcsprm struct. - wcsp = *wcs; ++ struct wcsprm *wcsp = *wcs; *nwcs = 0; - for (ialt = 0; ialt < 27; ialt++) { -@@ -25477,30 +25474,30 @@ int wcspih_init1( +- for (ialt = 0; ialt < 27; ialt++) { ++ for (int ialt = 0; ialt < 27; ialt++) { + if (alts[ialt]) { + wcsp->flag = -1; +- npvmax = npv[ialt]; +- npsmax = nps[ialt]; ++ int npvmax = npv[ialt]; ++ int npsmax = nps[ialt]; + if ((status = wcsinit(1, alts[ialt], wcsp, npvmax, npsmax, -1))) { + wcsvfree(nwcs, wcs); break; } @@ -10608,26 +11949,39 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c - /* Any distortions present? */ + // Any distortions present? ++ struct disprm *disp; if (dpq[ialt] & 1) { - if ((dis = calloc(1, sizeof(struct disprm))) == 0x0) { +- if ((dis = calloc(1, sizeof(struct disprm))) == 0x0) { ++ if ((disp = calloc(1, sizeof(struct disprm))) == 0x0) { return WCSHDRERR_MEMORY; } - /* Attach it to linprm. Also inits it. */ + // Attach it to linprm. Also inits it. ndis++; - ndpmax = ndp[ialt]; - dis->flag = -1; -@@ -25512,33 +25509,33 @@ int wcspih_init1( +- ndpmax = ndp[ialt]; +- dis->flag = -1; +- lindist(1, &(wcsp->lin), dis, ndpmax); ++ int ndpmax = ndp[ialt]; ++ disp->flag = -1; ++ lindist(1, &(wcsp->lin), disp, ndpmax); + } + + if (dpq[ialt] & 2) { +- if ((dis = calloc(1, sizeof(struct disprm))) == 0x0) { ++ if ((disp = calloc(1, sizeof(struct disprm))) == 0x0) { return WCSHDRERR_MEMORY; } - /* Attach it to linprm. Also inits it. */ + // Attach it to linprm. Also inits it. ndis++; - ndpmax = ndq[ialt]; - dis->flag = -1; - lindist(2, &(wcsp->lin), dis, ndpmax); +- ndpmax = ndq[ialt]; +- dis->flag = -1; +- lindist(2, &(wcsp->lin), dis, ndpmax); ++ int ndpmax = ndq[ialt]; ++ disp->flag = -1; ++ lindist(2, &(wcsp->lin), disp, ndpmax); } - /* On the second pass alts[] indexes the array of wcsprm structs. */ @@ -10659,7 +12013,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c (*wcs)->lin.dispre->ndp = 6; dpfill((*wcs)->lin.dispre->dp, "DP1", "NAXES", 0, 0, 2, 0.0); dpfill((*wcs)->lin.dispre->dp+3, "DP2", "NAXES", 0, 0, 2, 0.0); -@@ -25547,7 +25544,7 @@ int wcspih_init1( +@@ -25547,7 +25542,7 @@ int wcspih_init1( strcpy((*wcs)->lin.disseq->dtype[0], "DSS"); strcpy((*wcs)->lin.disseq->dtype[1], "DSS"); @@ -10668,7 +12022,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c (*wcs)->lin.disseq->ndp = 2; dpfill((*wcs)->lin.disseq->dp, "DQ1", "NAXES", 0, 0, 2, 0.0); dpfill((*wcs)->lin.disseq->dp+1, "DQ2", "NAXES", 0, 0, 2, 0.0); -@@ -25565,7 +25562,7 @@ int wcspih_init1( +@@ -25565,7 +25560,7 @@ int wcspih_init1( int wcspih_jdref(double *mjdref, const double *jdref) { @@ -10677,7 +12031,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c if (undefined(mjdref[0] && undefined(mjdref[1]))) { mjdref[0] = jdref[0] - 2400000.0; mjdref[1] = jdref[1] - 0.5; -@@ -25582,7 +25579,7 @@ int wcspih_jdref(double *mjdref, const d +@@ -25582,7 +25577,7 @@ int wcspih_jdref(double *mjdref, const d int wcspih_jdrefi(double *mjdref, const double *jdrefi) { @@ -10686,7 +12040,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c if (undefined(mjdref[0])) { mjdref[0] = *jdrefi - 2400000.5; } -@@ -25594,7 +25591,7 @@ int wcspih_jdrefi(double *mjdref, const +@@ -25594,7 +25589,7 @@ int wcspih_jdrefi(double *mjdref, const int wcspih_jdreff(double *mjdref, const double *jdreff) { @@ -10695,7 +12049,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c if (undefined(mjdref[1])) { mjdref[1] = *jdreff; } -@@ -25610,7 +25607,7 @@ int wcspih_jdreff(double *mjdref, const +@@ -25610,7 +25605,7 @@ int wcspih_jdreff(double *mjdref, const int wcspih_epoch(double *equinox, const double *epoch) { @@ -10704,24 +12058,39 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c if (undefined(*equinox)) { *equinox = *epoch; } -@@ -25628,9 +25625,9 @@ int wcspih_vsource(double *zsource, cons +@@ -25626,12 +25621,12 @@ int wcspih_epoch(double *equinox, const + int wcspih_vsource(double *zsource, const double *vsource) + { - double beta, c = 299792458.0; +- double beta, c = 299792458.0; ++ const double c = 299792458.0; - /* If ZSOURCEa is currently undefined then set it from VSOURCEa. */ + // If ZSOURCEa is currently undefined then set it from VSOURCEa. if (undefined(*zsource)) { - /* Convert relativistic Doppler velocity to redshift. */ +- beta = *vsource/c; + // Convert relativistic Doppler velocity to redshift. - beta = *vsource/c; ++ double beta = *vsource/c; *zsource = (1.0 + beta)/sqrt(1.0 - beta*beta) - 1.0; } -@@ -25672,23 +25669,23 @@ int wcspih_final( - struct wcsprm *wcsp; - for (ialt = 0; ialt < *nwcs; ialt++) { +@@ -25664,58 +25659,52 @@ int wcspih_final( + struct wcsprm **wcs) + + { +- char field[32], *wp, wpoly[12], wtype[8]; +- int i, ialt, idp, ipv, m, npv, n, nterms, omax, omin, status, wctrl[4]; +- double A1, A2, A3, B1, B2, B3, CNPIX1, CNPIX2, *crval, Rx, Ry, S, wval, +- X0, Y0, Xc, Yc; +- struct disprm *disp; +- struct wcsprm *wcsp; +- +- for (ialt = 0; ialt < *nwcs; ialt++) { - /* Interpret -TAB header keywords. */ ++ for (int ialt = 0; ialt < *nwcs; ialt++) { + // Interpret -TAB header keywords. ++ int status; if ((status = wcstab(*wcs+ialt))) { wcsvfree(nwcs, wcs); return status; @@ -10737,26 +12106,72 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c } - /* Translated distortion functions; apply only to the primary WCS. */ +- wcsp = *wcs; + // Translated distortion functions; apply only to the primary WCS. - wcsp = *wcs; ++ struct wcsprm *wcsp = *wcs; if (distran == SIP) { - /* SIP doesn't have alternates, nor axis mapping. */ +- disp = wcsp->lin.dispre; + // SIP doesn't have alternates, nor axis mapping. - disp = wcsp->lin.dispre; ++ struct disprm *disp = wcsp->lin.dispre; dpfill(disp->dp+1, "DP1", "OFFSET.1", 0, 1, 0, wcsp->crpix[0]); dpfill(disp->dp+2, "DP1", "OFFSET.2", 0, 1, 0, wcsp->crpix[1]); -@@ -25696,8 +25693,8 @@ int wcspih_final( + dpfill(disp->dp+4, "DP2", "OFFSET.1", 0, 1, 0, wcsp->crpix[0]); dpfill(disp->dp+5, "DP2", "OFFSET.2", 0, 1, 0, wcsp->crpix[1]); } else if (distran == DSS) { - /* DSS doesn't have alternates, nor axis mapping. This translation */ - /* follows Paper IV, Sect. 5.2 using the same variable names. */ +- CNPIX1 = dsstmp[0]; +- CNPIX2 = dsstmp[1]; +- +- Xc = dsstmp[2]/1000.0; +- Yc = dsstmp[3]/1000.0; +- Rx = dsstmp[4]/1000.0; +- Ry = dsstmp[5]/1000.0; +- +- A1 = dsstmp[14]; +- A2 = dsstmp[15]; +- A3 = dsstmp[16]; +- B1 = dsstmp[17]; +- B2 = dsstmp[18]; +- B3 = dsstmp[19]; +- S = sqrt(fabs(A1*B1 - A2*B2)); + // DSS doesn't have alternates, nor axis mapping. This translation + // follows Paper IV, Sect. 5.2 using the same variable names. - CNPIX1 = dsstmp[0]; - CNPIX2 = dsstmp[1]; ++ double CNPIX1 = dsstmp[0]; ++ double CNPIX2 = dsstmp[1]; ++ ++ double Xc = dsstmp[2]/1000.0; ++ double Yc = dsstmp[3]/1000.0; ++ double Rx = dsstmp[4]/1000.0; ++ double Ry = dsstmp[5]/1000.0; ++ ++ double A1 = dsstmp[14]; ++ double A2 = dsstmp[15]; ++ double A3 = dsstmp[16]; ++ double B1 = dsstmp[17]; ++ double B2 = dsstmp[18]; ++ double B3 = dsstmp[19]; ++ double S = sqrt(fabs(A1*B1 - A2*B2)); -@@ -25739,17 +25736,17 @@ int wcspih_final( +- X0 = (A2*B3 - A3*B1) / (A1*B1 - A2*B2); +- Y0 = (A3*B2 - A1*B3) / (A1*B1 - A2*B2); ++ double X0 = (A2*B3 - A3*B1) / (A1*B1 - A2*B2); ++ double Y0 = (A3*B2 - A1*B3) / (A1*B1 - A2*B2); + + wcsp->crpix[0] = (Xc - X0)/Rx - (CNPIX1 - 0.5); + wcsp->crpix[1] = (Yc + Y0)/Ry - (CNPIX2 - 0.5); +@@ -25729,7 +25718,7 @@ int wcspih_final( + wcsp->cdelt[0] = -S/3600.0; + wcsp->cdelt[1] = S/3600.0; + +- crval = wcsp->crval; ++ double *crval = wcsp->crval; + crval[0] = (dsstmp[6] + (dsstmp[7] + dsstmp[8] /60.0)/60.0)*15.0; + crval[1] = dsstmp[10] + (dsstmp[11] + dsstmp[12]/60.0)/60.0; + if (dsstmp[9] == -1.0) crval[1] *= -1.0; +@@ -25739,19 +25728,23 @@ int wcspih_final( sprintf(wcsp->wcsname, "DSS PLATEID %.4s", (char *)(dsstmp+13)); @@ -10769,15 +12184,23 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c } else if (distran == WAT) { - /* TNX and ZPX don't have alternates, nor axis mapping. */ +- disp = wcsp->lin.disseq; + // TNX and ZPX don't have alternates, nor axis mapping. - disp = wcsp->lin.disseq; ++ char *wp; ++ int omax, omin, wctrl[4]; ++ double wval; ++ struct disprm *disp = wcsp->lin.disseq; - /* Disassemble the core dump stored in the WATi_m strings. */ +- nterms = 0; + // Disassemble the core dump stored in the WATi_m strings. - nterms = 0; ++ int i, nterms = 0; for (i = 0; i < 2; i++) { ++ char wtype[8]; sscanf(wat[i], "wtype=%s", wtype); -@@ -25759,22 +25756,22 @@ int wcspih_final( + + if (strcmp(wtype, "tnx") == 0) { +@@ -25759,22 +25752,23 @@ int wcspih_final( } else if (strcmp(wtype, "zpx") == 0) { strcpy(disp->dtype[i], "WAT-ZPX"); } else { @@ -10792,9 +12215,11 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c if (i == 1 && strcmp(wtype, "zpx") == 0) { - /* Take those on the second (latitude) axis ignoring the other. */ - /* First we have to count them and allocate space in wcsprm. */ +- wp = wat[i]; + // Take those on the second (latitude) axis ignoring the other. + // First we have to count them and allocate space in wcsprm. - wp = wat[i]; ++ wp = wat[i]; ++ int npv; for (npv = 0; npv < 30; npv++) { if ((wp = strstr(wp, "projp")) == 0x0) break; wp += 5; @@ -10805,16 +12230,22 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c if (npv) { wcsp->npvmax += npv; wcsp->pv = realloc(wcsp->pv, wcsp->npvmax*sizeof(struct pvcard)); -@@ -25785,7 +25782,7 @@ int wcspih_final( +@@ -25785,11 +25779,12 @@ int wcspih_final( wcsp->m_pv = wcsp->pv; } - /* Copy the values. */ + // Copy the values. wp = wat[i]; - for (ipv = wcsp->npv; ipv < wcsp->npvmax; ipv++) { +- for (ipv = wcsp->npv; ipv < wcsp->npvmax; ipv++) { ++ for (int ipv = wcsp->npv; ipv < wcsp->npvmax; ipv++) { if ((wp = strstr(wp, "projp")) == 0x0) break; -@@ -25801,7 +25798,7 @@ int wcspih_final( + ++ int m; + sscanf(wp, "projp%d=%lf", &m, &wval); + wcsp->pv[ipv].i = 2; + wcsp->pv[ipv].m = m; +@@ -25801,13 +25796,13 @@ int wcspih_final( wcsp->npv += npv; } @@ -10823,7 +12254,14 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c if ((wp = strchr(wat[i], '"')) == 0x0) { return WCSHDRERR_PARSER; } -@@ -25815,24 +25812,24 @@ int wcspih_final( + wp++; + +- for (m = 0; m < 4; m++) { ++ for (int m = 0; m < 4; m++) { + sscanf(wp, "%d", wctrl+m); + if ((wp = strchr(wp, ' ')) == 0x0) { + return WCSHDRERR_PARSER; +@@ -25815,24 +25810,24 @@ int wcspih_final( wp++; } @@ -10853,13 +12291,14 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c ndq[0] += 2*(1 + 1 + 4) + nterms; disp->ndpmax += ndq[0]; -@@ -25844,12 +25841,12 @@ int wcspih_final( +@@ -25844,18 +25839,18 @@ int wcspih_final( disp->m_dp = disp->dp; - /* Populate dpkeys. */ +- idp = disp->ndp; + // Populate dpkeys. - idp = disp->ndp; ++ int idp = disp->ndp; for (i = 0; i < 2; i++) { dpfill(disp->dp+(idp++), "DQ", "NAXES", i+1, 0, 2, 0.0); @@ -10868,12 +12307,20 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c if ((wp = strchr(wat[i], '"')) == 0x0) { return WCSHDRERR_PARSER; } -@@ -25863,23 +25860,23 @@ int wcspih_final( + wp++; + +- for (m = 0; m < 4; m++) { ++ for (int m = 0; m < 4; m++) { + sscanf(wp, "%d", wctrl+m); + if ((wp = strchr(wp, ' ')) == 0x0) { + return WCSHDRERR_PARSER; +@@ -25863,24 +25858,26 @@ int wcspih_final( wp++; } - /* Polynomial type. */ + // Polynomial type. ++ char wpoly[12]; dpfill(disp->dp+(idp++), "DQ", "WAT.POLY", i+1, 0, wctrl[0], 0.0); if (wctrl[0] == 1) { - /* Chebyshev polynomial. */ @@ -10894,23 +12341,30 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcspih.c } - /* Read the scaling parameters. */ +- for (m = 0; m < 4; m++) { + // Read the scaling parameters. - for (m = 0; m < 4; m++) { ++ char field[40]; ++ for (int m = 0; m < 4; m++) { sscanf(wp, "%lf", &wval); sprintf(field, "WAT.%c%s", (m<2)?'X':'Y', (m%2)?"MAX":"MIN"); -@@ -25891,7 +25888,7 @@ int wcspih_final( + dpfill(disp->dp+(idp++), "DQ", field, i+1, 1, 0, wval); +@@ -25891,9 +25888,9 @@ int wcspih_final( wp++; } - /* Read the coefficients. */ +- for (n = 0; n < wctrl[2]; n++) { +- for (m = 0; m < wctrl[1]; m++) { + // Read the coefficients. - for (n = 0; n < wctrl[2]; n++) { - for (m = 0; m < wctrl[1]; m++) { ++ for (int n = 0; n < wctrl[2]; n++) { ++ for (int m = 0; m < wctrl[1]; m++) { if (wctrl[3] == 0) { -Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c + if (m && n) continue; + } else if (wctrl[3] == 2) { +Index: astropy-4.2.1/cextern/wcslib/C/flexed/wcsulex.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/flexed/wcsulex.c -+++ astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c +--- astropy-4.2.1.orig/cextern/wcslib/C/flexed/wcsulex.c ++++ astropy-4.2.1/cextern/wcslib/C/flexed/wcsulex.c @@ -7150,9 +7150,8 @@ static const yy_state_type yy_NUL_trans[ #define YY_RESTORE_YY_MORE_OFFSET #line 1 "wcsulex.l" @@ -10918,7 +12372,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -10932,7 +12386,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsulex.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcsulex.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcsulex.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * * wcsulex.l is a Flex description file containing the definition of a @@ -10941,27 +12395,49 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c /* Exclusive start states. */ -#line 87 "wcsulex.l" -+#line 84 "wcsulex.l" ++#line 85 "wcsulex.l" #include #include #include -@@ -7213,7 +7210,7 @@ static int wcsulex_scanner(const char un - double units[WCSUNITS_NTYPE], struct wcserr **err, - yyscan_t yyscanner); +@@ -7209,47 +7206,27 @@ static const yy_state_type yy_NUL_trans[ + #include "wcsunits.h" + #include "wcsutil.h" +-static int wcsulex_scanner(const char unitstr[], int *func, double *scale, +- double units[WCSUNITS_NTYPE], struct wcserr **err, +- yyscan_t yyscanner); +- -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- - - int wcsulexe( - const char unitstr[], -@@ -7235,21 +7232,21 @@ int wcsulexe( - return status; - } - +- +-int wcsulexe( +- const char unitstr[], +- int *func, +- double *scale, +- double units[WCSUNITS_NTYPE], +- struct wcserr **err) +- +-{ +- int status; +- yyscan_t yyscanner; +- int yylex_init(yyscan_t *yyscanner); +- int yylex_destroy(yyscan_t yyscanner); +- +- yylex_init(&yyscanner); +- status = wcsulex_scanner(unitstr, func, scale, units, err, yyscanner); +- yylex_destroy(yyscanner); +- +- return status; +-} +- -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- ++// User data associated with yyscanner. ++struct wcsulex_extra { ++ // Used in preempting the call to exit() by yy_fatal_error(). ++ jmp_buf abort_jmp_env; ++}; - #define YY_DECL int wcsulex_scanner(const char unitstr[], int *func, \ +-#define YY_DECL int wcsulex_scanner(const char unitstr[], int *func, \ ++#define YY_DECL int wcsulexe_scanner(const char unitstr[], int *func, \ double *scale, double units[WCSUNITS_NTYPE], struct wcserr **err, \ yyscan_t yyscanner) @@ -10970,32 +12446,82 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c #define YY_INPUT(inbuff, count, bufsize) { count = YY_NULL; } -/* Used in preempting the call to exit() by yy_fatal_error(). */ -+// Used in preempting the call to exit() by yy_fatal_error(). - jmp_buf wcsulex_abort_jmp_env; - #define exit(status) longjmp(wcsulex_abort_jmp_env, status) +-jmp_buf wcsulex_abort_jmp_env; +-#define exit(status) longjmp(wcsulex_abort_jmp_env, status) ++// Preempt the call to exit() by yy_fatal_error(). ++#define exit(status) longjmp(yyextra->abort_jmp_env, status); ++ ++// Internal helper functions. ++static YY_DECL; -#line 7252 "wcsulex.c" -#line 7253 "wcsulex.c" -+#line 7249 "wcsulex.c" -+#line 7250 "wcsulex.c" ++#line 7229 "wcsulex.c" ++#line 7230 "wcsulex.c" #define INITIAL 0 #define PAREN 1 -@@ -7501,9 +7498,9 @@ YY_DECL +@@ -7266,9 +7243,7 @@ jmp_buf wcsulex_abort_jmp_env; + #include + #endif + +-#ifndef YY_EXTRA_TYPE +-#define YY_EXTRA_TYPE void * +-#endif ++#define YY_EXTRA_TYPE struct wcsulex_extra * + + /* Holds the entire state of the reentrant scanner. */ + struct yyguts_t +@@ -7501,42 +7476,45 @@ YY_DECL } { -#line 138 "wcsulex.l" -+#line 135 "wcsulex.l" ++#line 116 "wcsulex.l" -#line 140 "wcsulex.l" -+#line 137 "wcsulex.l" - static const char *function = "wcsulexe"; +- static const char *function = "wcsulexe"; ++#line 118 "wcsulex.l" ++ static const char *function = "wcsulexe_scanner"; - char ctmp[72]; -@@ -7528,14 +7525,14 @@ YY_DECL - factor = 1.0; - *scale = 1.0; +- char ctmp[72]; +- int bracket = 0; +- int operator = 0; +- int paren = 0; +- int status = 0; +- int func_r, i, j; +- double dexp, expon, factor, factor_r, types[WCSUNITS_NTYPE]; +- YY_BUFFER_STATE buf; + void add(double *factor, double types[], double *expon, double *scale, + double units[]); + +- if (err) *err = 0x0; ++ // Initialise returned values. ++ *func = 0; ++ *scale = 1.0; + +- *func = 0; +- for (i = 0; i < WCSUNITS_NTYPE; i++) { ++ for (int i = 0; i < WCSUNITS_NTYPE; i++) { + units[i] = 0.0; ++ } ++ ++ if (err) *err = 0x0; ++ ++ double types[WCSUNITS_NTYPE]; ++ for (int i = 0; i < WCSUNITS_NTYPE; i++) { + types[i] = 0.0; + } +- expon = 1.0; +- factor = 1.0; +- *scale = 1.0; ++ double expon = 1.0; ++ double factor = 1.0; ++ ++ int bracket = 0; ++ int operator = 0; ++ int paren = 0; ++ int status = 0; - /* Avert a flex-induced memory leak. */ + // Avert a flex-induced memory leak. @@ -11006,25 +12532,27 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c yy_scan_string(unitstr, yyscanner); - /* Return here via longjmp() invoked by yy_fatal_error(). */ +- if (setjmp(wcsulex_abort_jmp_env)) { + // Return here via longjmp() invoked by yy_fatal_error(). - if (setjmp(wcsulex_abort_jmp_env)) { ++ if (setjmp(yyextra->abort_jmp_env)) { return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR), "Internal units parser error parsing '%s'", unitstr); -@@ -7547,7 +7544,7 @@ YY_DECL + } +@@ -7547,7 +7525,7 @@ YY_DECL fprintf(stderr, "\n%s ->\n", unitstr); #endif -#line 7551 "wcsulex.c" -+#line 7548 "wcsulex.c" ++#line 7529 "wcsulex.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { -@@ -7601,15 +7598,15 @@ do_action: /* This label is used only to +@@ -7601,15 +7579,15 @@ do_action: /* This label is used only to case 1: YY_RULE_SETUP -#line 183 "wcsulex.l" -+#line 180 "wcsulex.l" ++#line 164 "wcsulex.l" { - /* Pretend initial whitespace doesn't exist. */ + // Pretend initial whitespace doesn't exist. @@ -11034,89 +12562,89 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 2: YY_RULE_SETUP -#line 188 "wcsulex.l" -+#line 185 "wcsulex.l" ++#line 169 "wcsulex.l" { if (bracket++) { BEGIN(FLUSH); -@@ -7620,7 +7617,7 @@ YY_RULE_SETUP +@@ -7620,7 +7598,7 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 196 "wcsulex.l" -+#line 193 "wcsulex.l" ++#line 177 "wcsulex.l" { status = wcserr_set(WCSERR_SET(UNITSERR_BAD_NUM_MULTIPLIER), "Invalid exponent in '%s'", unitstr); -@@ -7629,7 +7626,7 @@ YY_RULE_SETUP +@@ -7629,7 +7607,7 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 202 "wcsulex.l" -+#line 199 "wcsulex.l" ++#line 183 "wcsulex.l" { factor = 10.0; BEGIN(EXPON); -@@ -7637,7 +7634,7 @@ YY_RULE_SETUP +@@ -7637,7 +7615,7 @@ YY_RULE_SETUP YY_BREAK case 5: YY_RULE_SETUP -#line 207 "wcsulex.l" -+#line 204 "wcsulex.l" ++#line 188 "wcsulex.l" { *func = 1; unput('('); -@@ -7646,7 +7643,7 @@ YY_RULE_SETUP +@@ -7646,7 +7624,7 @@ YY_RULE_SETUP YY_BREAK case 6: YY_RULE_SETUP -#line 213 "wcsulex.l" -+#line 210 "wcsulex.l" ++#line 194 "wcsulex.l" { *func = 2; unput('('); -@@ -7655,7 +7652,7 @@ YY_RULE_SETUP +@@ -7655,7 +7633,7 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 219 "wcsulex.l" -+#line 216 "wcsulex.l" ++#line 200 "wcsulex.l" { *func = 3; unput('('); -@@ -7664,9 +7661,9 @@ YY_RULE_SETUP +@@ -7664,9 +7642,9 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 225 "wcsulex.l" -+#line 222 "wcsulex.l" ++#line 206 "wcsulex.l" { - /* Leading binary multiply. */ + // Leading binary multiply. status = wcserr_set(WCSERR_SET(UNITSERR_DANGLING_BINOP), "Dangling binary operator in '%s'", unitstr); BEGIN(FLUSH); -@@ -7674,12 +7671,12 @@ YY_RULE_SETUP +@@ -7674,12 +7652,12 @@ YY_RULE_SETUP YY_BREAK case 9: YY_RULE_SETUP -#line 232 "wcsulex.l" -/* Discard whitespace in INITIAL context. */ -+#line 229 "wcsulex.l" ++#line 213 "wcsulex.l" +// Discard whitespace in INITIAL context. YY_BREAK case 10: YY_RULE_SETUP -#line 234 "wcsulex.l" -+#line 231 "wcsulex.l" ++#line 215 "wcsulex.l" { expon /= 2.0; unput('('); -@@ -7688,16 +7685,16 @@ YY_RULE_SETUP +@@ -7688,16 +7666,16 @@ YY_RULE_SETUP YY_BREAK case 11: YY_RULE_SETUP -#line 240 "wcsulex.l" -+#line 237 "wcsulex.l" ++#line 221 "wcsulex.l" { - /* Gather terms in parentheses. */ + // Gather terms in parentheses. @@ -11127,81 +12655,81 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 12: YY_RULE_SETUP -#line 246 "wcsulex.l" -+#line 243 "wcsulex.l" ++#line 227 "wcsulex.l" { if (operator++) { BEGIN(FLUSH); -@@ -7705,10 +7702,10 @@ YY_RULE_SETUP +@@ -7705,10 +7683,10 @@ YY_RULE_SETUP } YY_BREAK case 13: -#line 253 "wcsulex.l" -+#line 250 "wcsulex.l" ++#line 234 "wcsulex.l" case 14: YY_RULE_SETUP -#line 253 "wcsulex.l" -+#line 250 "wcsulex.l" ++#line 234 "wcsulex.l" { if (operator++) { BEGIN(FLUSH); -@@ -7719,7 +7716,7 @@ YY_RULE_SETUP +@@ -7719,7 +7697,7 @@ YY_RULE_SETUP YY_BREAK case 15: YY_RULE_SETUP -#line 261 "wcsulex.l" -+#line 258 "wcsulex.l" ++#line 242 "wcsulex.l" { operator = 0; yyless(0); -@@ -7727,12 +7724,12 @@ YY_RULE_SETUP +@@ -7727,12 +7705,12 @@ YY_RULE_SETUP } YY_BREAK case 16: -#line 268 "wcsulex.l" -+#line 265 "wcsulex.l" ++#line 249 "wcsulex.l" case 17: -#line 269 "wcsulex.l" -+#line 266 "wcsulex.l" ++#line 250 "wcsulex.l" case 18: YY_RULE_SETUP -#line 269 "wcsulex.l" -+#line 266 "wcsulex.l" ++#line 250 "wcsulex.l" { operator = 0; yyless(0); -@@ -7741,7 +7738,7 @@ YY_RULE_SETUP +@@ -7741,7 +7719,7 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 275 "wcsulex.l" -+#line 272 "wcsulex.l" ++#line 256 "wcsulex.l" { bracket = !bracket; BEGIN(FLUSH); -@@ -7749,7 +7746,7 @@ YY_RULE_SETUP +@@ -7749,7 +7727,7 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 280 "wcsulex.l" -+#line 277 "wcsulex.l" ++#line 261 "wcsulex.l" { status = wcserr_set(WCSERR_SET(UNITSERR_BAD_INITIAL_SYMBOL), "Invalid symbol in INITIAL context in '%s'", unitstr); -@@ -7758,7 +7755,7 @@ YY_RULE_SETUP +@@ -7758,7 +7736,7 @@ YY_RULE_SETUP YY_BREAK case 21: YY_RULE_SETUP -#line 286 "wcsulex.l" -+#line 283 "wcsulex.l" ++#line 267 "wcsulex.l" { paren++; operator = 0; -@@ -7767,15 +7764,15 @@ YY_RULE_SETUP +@@ -7767,19 +7745,22 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 292 "wcsulex.l" -+#line 289 "wcsulex.l" ++#line 273 "wcsulex.l" { paren--; if (paren) { @@ -11214,13 +12742,21 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c + // Balanced; strip off the outer parentheses and recurse. yytext[yyleng-1] = '\0'; - buf = YY_CURRENT_BUFFER; -@@ -7799,14 +7796,14 @@ YY_RULE_SETUP +- buf = YY_CURRENT_BUFFER; ++ int func_r; ++ double factor_r; + status = wcsulexe(yytext+1, &func_r, &factor_r, types, err); ++ ++ YY_BUFFER_STATE buf = YY_CURRENT_BUFFER; + yy_switch_to_buffer(buf, yyscanner); + + if (func_r) { +@@ -7799,14 +7780,14 @@ YY_RULE_SETUP case 23: /* rule 23 can match eol */ YY_RULE_SETUP -#line 320 "wcsulex.l" -+#line 317 "wcsulex.l" ++#line 304 "wcsulex.l" { yymore(); } @@ -11228,223 +12764,223 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 24: YY_RULE_SETUP -#line 324 "wcsulex.l" -+#line 321 "wcsulex.l" ++#line 308 "wcsulex.l" { factor = 1e-1; BEGIN(UNITS); -@@ -7814,7 +7811,7 @@ YY_RULE_SETUP +@@ -7814,7 +7795,7 @@ YY_RULE_SETUP YY_BREAK case 25: YY_RULE_SETUP -#line 329 "wcsulex.l" -+#line 326 "wcsulex.l" ++#line 313 "wcsulex.l" { factor = 1e-2; BEGIN(UNITS); -@@ -7822,7 +7819,7 @@ YY_RULE_SETUP +@@ -7822,7 +7803,7 @@ YY_RULE_SETUP YY_BREAK case 26: YY_RULE_SETUP -#line 334 "wcsulex.l" -+#line 331 "wcsulex.l" ++#line 318 "wcsulex.l" { factor = 1e-3; BEGIN(UNITS); -@@ -7830,7 +7827,7 @@ YY_RULE_SETUP +@@ -7830,7 +7811,7 @@ YY_RULE_SETUP YY_BREAK case 27: YY_RULE_SETUP -#line 339 "wcsulex.l" -+#line 336 "wcsulex.l" ++#line 323 "wcsulex.l" { factor = 1e-6; BEGIN(UNITS); -@@ -7838,7 +7835,7 @@ YY_RULE_SETUP +@@ -7838,7 +7819,7 @@ YY_RULE_SETUP YY_BREAK case 28: YY_RULE_SETUP -#line 344 "wcsulex.l" -+#line 341 "wcsulex.l" ++#line 328 "wcsulex.l" { factor = 1e-9; BEGIN(UNITS); -@@ -7846,7 +7843,7 @@ YY_RULE_SETUP +@@ -7846,7 +7827,7 @@ YY_RULE_SETUP YY_BREAK case 29: YY_RULE_SETUP -#line 349 "wcsulex.l" -+#line 346 "wcsulex.l" ++#line 333 "wcsulex.l" { factor = 1e-12; BEGIN(UNITS); -@@ -7854,7 +7851,7 @@ YY_RULE_SETUP +@@ -7854,7 +7835,7 @@ YY_RULE_SETUP YY_BREAK case 30: YY_RULE_SETUP -#line 354 "wcsulex.l" -+#line 351 "wcsulex.l" ++#line 338 "wcsulex.l" { factor = 1e-15; BEGIN(UNITS); -@@ -7862,7 +7859,7 @@ YY_RULE_SETUP +@@ -7862,7 +7843,7 @@ YY_RULE_SETUP YY_BREAK case 31: YY_RULE_SETUP -#line 359 "wcsulex.l" -+#line 356 "wcsulex.l" ++#line 343 "wcsulex.l" { factor = 1e-18; BEGIN(UNITS); -@@ -7870,7 +7867,7 @@ YY_RULE_SETUP +@@ -7870,7 +7851,7 @@ YY_RULE_SETUP YY_BREAK case 32: YY_RULE_SETUP -#line 364 "wcsulex.l" -+#line 361 "wcsulex.l" ++#line 348 "wcsulex.l" { factor = 1e-21; BEGIN(UNITS); -@@ -7878,7 +7875,7 @@ YY_RULE_SETUP +@@ -7878,7 +7859,7 @@ YY_RULE_SETUP YY_BREAK case 33: YY_RULE_SETUP -#line 369 "wcsulex.l" -+#line 366 "wcsulex.l" ++#line 353 "wcsulex.l" { factor = 1e-24; BEGIN(UNITS); -@@ -7886,7 +7883,7 @@ YY_RULE_SETUP +@@ -7886,7 +7867,7 @@ YY_RULE_SETUP YY_BREAK case 34: YY_RULE_SETUP -#line 374 "wcsulex.l" -+#line 371 "wcsulex.l" ++#line 358 "wcsulex.l" { factor = 1e+1; BEGIN(UNITS); -@@ -7894,7 +7891,7 @@ YY_RULE_SETUP +@@ -7894,7 +7875,7 @@ YY_RULE_SETUP YY_BREAK case 35: YY_RULE_SETUP -#line 379 "wcsulex.l" -+#line 376 "wcsulex.l" ++#line 363 "wcsulex.l" { factor = 1e+2; BEGIN(UNITS); -@@ -7902,7 +7899,7 @@ YY_RULE_SETUP +@@ -7902,7 +7883,7 @@ YY_RULE_SETUP YY_BREAK case 36: YY_RULE_SETUP -#line 384 "wcsulex.l" -+#line 381 "wcsulex.l" ++#line 368 "wcsulex.l" { factor = 1e+3; BEGIN(UNITS); -@@ -7910,7 +7907,7 @@ YY_RULE_SETUP +@@ -7910,7 +7891,7 @@ YY_RULE_SETUP YY_BREAK case 37: YY_RULE_SETUP -#line 389 "wcsulex.l" -+#line 386 "wcsulex.l" ++#line 373 "wcsulex.l" { factor = 1e+6; BEGIN(UNITS); -@@ -7918,7 +7915,7 @@ YY_RULE_SETUP +@@ -7918,7 +7899,7 @@ YY_RULE_SETUP YY_BREAK case 38: YY_RULE_SETUP -#line 394 "wcsulex.l" -+#line 391 "wcsulex.l" ++#line 378 "wcsulex.l" { factor = 1e+9; BEGIN(UNITS); -@@ -7926,7 +7923,7 @@ YY_RULE_SETUP +@@ -7926,7 +7907,7 @@ YY_RULE_SETUP YY_BREAK case 39: YY_RULE_SETUP -#line 399 "wcsulex.l" -+#line 396 "wcsulex.l" ++#line 383 "wcsulex.l" { factor = 1e+12; BEGIN(UNITS); -@@ -7934,7 +7931,7 @@ YY_RULE_SETUP +@@ -7934,7 +7915,7 @@ YY_RULE_SETUP YY_BREAK case 40: YY_RULE_SETUP -#line 404 "wcsulex.l" -+#line 401 "wcsulex.l" ++#line 388 "wcsulex.l" { factor = 1e+15; BEGIN(UNITS); -@@ -7942,7 +7939,7 @@ YY_RULE_SETUP +@@ -7942,7 +7923,7 @@ YY_RULE_SETUP YY_BREAK case 41: YY_RULE_SETUP -#line 409 "wcsulex.l" -+#line 406 "wcsulex.l" ++#line 393 "wcsulex.l" { factor = 1e+18; BEGIN(UNITS); -@@ -7950,7 +7947,7 @@ YY_RULE_SETUP +@@ -7950,7 +7931,7 @@ YY_RULE_SETUP YY_BREAK case 42: YY_RULE_SETUP -#line 414 "wcsulex.l" -+#line 411 "wcsulex.l" ++#line 398 "wcsulex.l" { factor = 1e+21; BEGIN(UNITS); -@@ -7958,7 +7955,7 @@ YY_RULE_SETUP +@@ -7958,7 +7939,7 @@ YY_RULE_SETUP YY_BREAK case 43: YY_RULE_SETUP -#line 419 "wcsulex.l" -+#line 416 "wcsulex.l" ++#line 403 "wcsulex.l" { factor = 1e+24; BEGIN(UNITS); -@@ -7966,9 +7963,9 @@ YY_RULE_SETUP +@@ -7966,9 +7947,9 @@ YY_RULE_SETUP YY_BREAK case 44: YY_RULE_SETUP -#line 424 "wcsulex.l" -+#line 421 "wcsulex.l" ++#line 408 "wcsulex.l" { - /* Internal parser error. */ + // Internal parser error. status = wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR), "Internal units parser error parsing '%s'", unitstr); BEGIN(FLUSH); -@@ -7976,9 +7973,9 @@ YY_RULE_SETUP +@@ -7976,9 +7957,9 @@ YY_RULE_SETUP YY_BREAK case 45: YY_RULE_SETUP -#line 431 "wcsulex.l" -+#line 428 "wcsulex.l" ++#line 415 "wcsulex.l" { - /* Ampere. */ + // Ampere. types[WCSUNITS_CHARGE] += 1.0; types[WCSUNITS_TIME] -= 1.0; BEGIN(EXPON); -@@ -7986,9 +7983,9 @@ YY_RULE_SETUP +@@ -7986,9 +7967,9 @@ YY_RULE_SETUP YY_BREAK case 46: YY_RULE_SETUP -#line 438 "wcsulex.l" -+#line 435 "wcsulex.l" ++#line 422 "wcsulex.l" { - /* Julian year (annum). */ + // Julian year (annum). factor *= 31557600.0; types[WCSUNITS_TIME] += 1.0; BEGIN(EXPON); -@@ -7996,18 +7993,18 @@ YY_RULE_SETUP +@@ -7996,18 +7977,18 @@ YY_RULE_SETUP YY_BREAK case 47: YY_RULE_SETUP -#line 445 "wcsulex.l" -+#line 442 "wcsulex.l" ++#line 429 "wcsulex.l" { - /* Analogue-to-digital converter units. */ + // Analogue-to-digital converter units. @@ -11455,67 +12991,67 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 48: YY_RULE_SETUP -#line 451 "wcsulex.l" -+#line 448 "wcsulex.l" ++#line 435 "wcsulex.l" { - /* Angstrom. */ + // Angstrom. factor *= 1e-10; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); -@@ -8015,9 +8012,9 @@ YY_RULE_SETUP +@@ -8015,9 +7996,9 @@ YY_RULE_SETUP YY_BREAK case 49: YY_RULE_SETUP -#line 458 "wcsulex.l" -+#line 455 "wcsulex.l" ++#line 442 "wcsulex.l" { - /* Minute of arc. */ + // Minute of arc. factor /= 60.0; types[WCSUNITS_PLANE_ANGLE] += 1.0; BEGIN(EXPON); -@@ -8025,9 +8022,9 @@ YY_RULE_SETUP +@@ -8025,9 +8006,9 @@ YY_RULE_SETUP YY_BREAK case 50: YY_RULE_SETUP -#line 465 "wcsulex.l" -+#line 462 "wcsulex.l" ++#line 449 "wcsulex.l" { - /* Second of arc. */ + // Second of arc. factor /= 3600.0; types[WCSUNITS_PLANE_ANGLE] += 1.0; BEGIN(EXPON); -@@ -8035,9 +8032,9 @@ YY_RULE_SETUP +@@ -8035,9 +8016,9 @@ YY_RULE_SETUP YY_BREAK case 51: YY_RULE_SETUP -#line 472 "wcsulex.l" -+#line 469 "wcsulex.l" ++#line 456 "wcsulex.l" { - /* Astronomical unit. */ + // Astronomical unit. factor *= 1.49598e+11; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); -@@ -8045,9 +8042,9 @@ YY_RULE_SETUP +@@ -8045,9 +8026,9 @@ YY_RULE_SETUP YY_BREAK case 52: YY_RULE_SETUP -#line 479 "wcsulex.l" -+#line 476 "wcsulex.l" ++#line 463 "wcsulex.l" { - /* Barn. */ + // Barn. factor *= 1e-28; types[WCSUNITS_LENGTH] += 2.0; BEGIN(EXPON); -@@ -8055,36 +8052,36 @@ YY_RULE_SETUP +@@ -8055,36 +8036,36 @@ YY_RULE_SETUP YY_BREAK case 53: YY_RULE_SETUP -#line 486 "wcsulex.l" -+#line 483 "wcsulex.l" ++#line 470 "wcsulex.l" { - /* Beam, as in Jy/beam. */ + // Beam, as in Jy/beam. @@ -11526,7 +13062,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 54: YY_RULE_SETUP -#line 492 "wcsulex.l" -+#line 489 "wcsulex.l" ++#line 476 "wcsulex.l" { - /* Bin (e.g. histogram). */ + // Bin (e.g. histogram). @@ -11537,7 +13073,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 55: YY_RULE_SETUP -#line 498 "wcsulex.l" -+#line 495 "wcsulex.l" ++#line 482 "wcsulex.l" { - /* Bit. */ + // Bit. @@ -11548,19 +13084,19 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 56: YY_RULE_SETUP -#line 504 "wcsulex.l" -+#line 501 "wcsulex.l" ++#line 488 "wcsulex.l" { - /* Byte. */ + // Byte. factor *= 8.0; types[WCSUNITS_BIT] += 1.0; BEGIN(EXPON); -@@ -8092,45 +8089,45 @@ YY_RULE_SETUP +@@ -8092,45 +8073,45 @@ YY_RULE_SETUP YY_BREAK case 57: YY_RULE_SETUP -#line 511 "wcsulex.l" -+#line 508 "wcsulex.l" ++#line 495 "wcsulex.l" { - /* Coulomb. */ + // Coulomb. @@ -11571,7 +13107,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 58: YY_RULE_SETUP -#line 517 "wcsulex.l" -+#line 514 "wcsulex.l" ++#line 501 "wcsulex.l" { - /* Candela. */ + // Candela. @@ -11582,7 +13118,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 59: YY_RULE_SETUP -#line 523 "wcsulex.l" -+#line 520 "wcsulex.l" ++#line 507 "wcsulex.l" { - /* Channel. */ + // Channel. @@ -11593,7 +13129,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 60: YY_RULE_SETUP -#line 529 "wcsulex.l" -+#line 526 "wcsulex.l" ++#line 513 "wcsulex.l" { - /* Count. */ + // Count. @@ -11604,43 +13140,43 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 61: YY_RULE_SETUP -#line 535 "wcsulex.l" -+#line 532 "wcsulex.l" ++#line 519 "wcsulex.l" { - /* Julian century. */ + // Julian century. factor *= 3155760000.0; types[WCSUNITS_TIME] += 1.0; BEGIN(EXPON); -@@ -8138,9 +8135,9 @@ YY_RULE_SETUP +@@ -8138,9 +8119,9 @@ YY_RULE_SETUP YY_BREAK case 62: YY_RULE_SETUP -#line 542 "wcsulex.l" -+#line 539 "wcsulex.l" ++#line 526 "wcsulex.l" { - /* Debye. */ + // Debye. factor *= 1e-29 / 3.0; types[WCSUNITS_CHARGE] += 1.0; types[WCSUNITS_LENGTH] += 1.0; -@@ -8149,9 +8146,9 @@ YY_RULE_SETUP +@@ -8149,9 +8130,9 @@ YY_RULE_SETUP YY_BREAK case 63: YY_RULE_SETUP -#line 550 "wcsulex.l" -+#line 547 "wcsulex.l" ++#line 534 "wcsulex.l" { - /* Day. */ + // Day. factor *= 86400.0; types[WCSUNITS_TIME] += 1.0; BEGIN(EXPON); -@@ -8159,18 +8156,18 @@ YY_RULE_SETUP +@@ -8159,18 +8140,18 @@ YY_RULE_SETUP YY_BREAK case 64: YY_RULE_SETUP -#line 557 "wcsulex.l" -+#line 554 "wcsulex.l" ++#line 541 "wcsulex.l" { - /* Degree. */ + // Degree. @@ -11651,91 +13187,91 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 65: YY_RULE_SETUP -#line 563 "wcsulex.l" -+#line 560 "wcsulex.l" ++#line 547 "wcsulex.l" { - /* Erg. */ + // Erg. factor *= 1e-7; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; -@@ -8180,9 +8177,9 @@ YY_RULE_SETUP +@@ -8180,9 +8161,9 @@ YY_RULE_SETUP YY_BREAK case 66: YY_RULE_SETUP -#line 572 "wcsulex.l" -+#line 569 "wcsulex.l" ++#line 556 "wcsulex.l" { - /* Electron volt. */ + // Electron volt. factor *= 1.6021765e-19; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; -@@ -8192,9 +8189,9 @@ YY_RULE_SETUP +@@ -8192,9 +8173,9 @@ YY_RULE_SETUP YY_BREAK case 67: YY_RULE_SETUP -#line 581 "wcsulex.l" -+#line 578 "wcsulex.l" ++#line 565 "wcsulex.l" { - /* Farad. */ + // Farad. types[WCSUNITS_MASS] -= 1.0; types[WCSUNITS_LENGTH] -= 2.0; types[WCSUNITS_TIME] += 3.0; -@@ -8204,9 +8201,9 @@ YY_RULE_SETUP +@@ -8204,9 +8185,9 @@ YY_RULE_SETUP YY_BREAK case 68: YY_RULE_SETUP -#line 590 "wcsulex.l" -+#line 587 "wcsulex.l" ++#line 574 "wcsulex.l" { - /* Gauss. */ + // Gauss. factor *= 1e-4; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_TIME] += 1.0; -@@ -8216,9 +8213,9 @@ YY_RULE_SETUP +@@ -8216,9 +8197,9 @@ YY_RULE_SETUP YY_BREAK case 69: YY_RULE_SETUP -#line 599 "wcsulex.l" -+#line 596 "wcsulex.l" ++#line 583 "wcsulex.l" { - /* Gram. */ + // Gram. factor *= 1e-3; types[WCSUNITS_MASS] += 1.0; BEGIN(EXPON); -@@ -8226,9 +8223,9 @@ YY_RULE_SETUP +@@ -8226,9 +8207,9 @@ YY_RULE_SETUP YY_BREAK case 70: YY_RULE_SETUP -#line 606 "wcsulex.l" -+#line 603 "wcsulex.l" ++#line 590 "wcsulex.l" { - /* Henry. */ + // Henry. types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] += 2.0; -@@ -8238,9 +8235,9 @@ YY_RULE_SETUP +@@ -8238,9 +8219,9 @@ YY_RULE_SETUP YY_BREAK case 71: YY_RULE_SETUP -#line 615 "wcsulex.l" -+#line 612 "wcsulex.l" ++#line 599 "wcsulex.l" { - /* Hour. */ + // Hour. factor *= 3600.0; types[WCSUNITS_TIME] += 1.0; BEGIN(EXPON); -@@ -8248,18 +8245,18 @@ YY_RULE_SETUP +@@ -8248,18 +8229,18 @@ YY_RULE_SETUP YY_BREAK case 72: YY_RULE_SETUP -#line 622 "wcsulex.l" -+#line 619 "wcsulex.l" ++#line 606 "wcsulex.l" { - /* Hertz. */ + // Hertz. @@ -11746,31 +13282,31 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 73: YY_RULE_SETUP -#line 628 "wcsulex.l" -+#line 625 "wcsulex.l" ++#line 612 "wcsulex.l" { - /* Joule. */ + // Joule. types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 2.0; -@@ -8268,9 +8265,9 @@ YY_RULE_SETUP +@@ -8268,9 +8249,9 @@ YY_RULE_SETUP YY_BREAK case 74: YY_RULE_SETUP -#line 636 "wcsulex.l" -+#line 633 "wcsulex.l" ++#line 620 "wcsulex.l" { - /* Jansky. */ + // Jansky. factor *= 1e-26; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_TIME] -= 2.0; -@@ -8279,18 +8276,18 @@ YY_RULE_SETUP +@@ -8279,18 +8260,18 @@ YY_RULE_SETUP YY_BREAK case 75: YY_RULE_SETUP -#line 644 "wcsulex.l" -+#line 641 "wcsulex.l" ++#line 628 "wcsulex.l" { - /* Kelvin. */ + // Kelvin. @@ -11781,43 +13317,43 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 76: YY_RULE_SETUP -#line 650 "wcsulex.l" -+#line 647 "wcsulex.l" ++#line 634 "wcsulex.l" { - /* Lumen. */ + // Lumen. types[WCSUNITS_LUMINTEN] += 1.0; types[WCSUNITS_SOLID_ANGLE] += 1.0; BEGIN(EXPON); -@@ -8298,9 +8295,9 @@ YY_RULE_SETUP +@@ -8298,9 +8279,9 @@ YY_RULE_SETUP YY_BREAK case 77: YY_RULE_SETUP -#line 657 "wcsulex.l" -+#line 654 "wcsulex.l" ++#line 641 "wcsulex.l" { - /* Lux. */ + // Lux. types[WCSUNITS_LUMINTEN] += 1.0; types[WCSUNITS_SOLID_ANGLE] += 1.0; types[WCSUNITS_LENGTH] -= 2.0; -@@ -8309,9 +8306,9 @@ YY_RULE_SETUP +@@ -8309,9 +8290,9 @@ YY_RULE_SETUP YY_BREAK case 78: YY_RULE_SETUP -#line 665 "wcsulex.l" -+#line 662 "wcsulex.l" ++#line 649 "wcsulex.l" { - /* Light year. */ + // Light year. factor *= 2.99792458e8 * 31557600.0; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); -@@ -8319,27 +8316,27 @@ YY_RULE_SETUP +@@ -8319,27 +8300,27 @@ YY_RULE_SETUP YY_BREAK case 79: YY_RULE_SETUP -#line 672 "wcsulex.l" -+#line 669 "wcsulex.l" ++#line 656 "wcsulex.l" { - /* Metre. */ + // Metre. @@ -11828,7 +13364,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 80: YY_RULE_SETUP -#line 678 "wcsulex.l" -+#line 675 "wcsulex.l" ++#line 662 "wcsulex.l" { - /* Stellar magnitude. */ + // Stellar magnitude. @@ -11839,31 +13375,31 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 81: YY_RULE_SETUP -#line 684 "wcsulex.l" -+#line 681 "wcsulex.l" ++#line 668 "wcsulex.l" { - /* Milli-arcsec. */ + // Milli-arcsec. factor /= 3600e+3; types[WCSUNITS_PLANE_ANGLE] += 1.0; BEGIN(EXPON); -@@ -8347,9 +8344,9 @@ YY_RULE_SETUP +@@ -8347,9 +8328,9 @@ YY_RULE_SETUP YY_BREAK case 82: YY_RULE_SETUP -#line 691 "wcsulex.l" -+#line 688 "wcsulex.l" ++#line 675 "wcsulex.l" { - /* Minute. */ + // Minute. factor *= 60.0; types[WCSUNITS_TIME] += 1.0; BEGIN(EXPON); -@@ -8357,18 +8354,18 @@ YY_RULE_SETUP +@@ -8357,18 +8338,18 @@ YY_RULE_SETUP YY_BREAK case 83: YY_RULE_SETUP -#line 698 "wcsulex.l" -+#line 695 "wcsulex.l" ++#line 682 "wcsulex.l" { - /* Mole. */ + // Mole. @@ -11874,55 +13410,55 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 84: YY_RULE_SETUP -#line 704 "wcsulex.l" -+#line 701 "wcsulex.l" ++#line 688 "wcsulex.l" { - /* Newton. */ + // Newton. types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 1.0; types[WCSUNITS_TIME] -= 2.0; -@@ -8377,9 +8374,9 @@ YY_RULE_SETUP +@@ -8377,9 +8358,9 @@ YY_RULE_SETUP YY_BREAK case 85: YY_RULE_SETUP -#line 712 "wcsulex.l" -+#line 709 "wcsulex.l" ++#line 696 "wcsulex.l" { - /* Ohm. */ + // Ohm. types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 1.0; -@@ -8389,9 +8386,9 @@ YY_RULE_SETUP +@@ -8389,9 +8370,9 @@ YY_RULE_SETUP YY_BREAK case 86: YY_RULE_SETUP -#line 721 "wcsulex.l" -+#line 718 "wcsulex.l" ++#line 705 "wcsulex.l" { - /* Pascal. */ + // Pascal. types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] -= 1.0; types[WCSUNITS_TIME] -= 2.0; -@@ -8400,9 +8397,9 @@ YY_RULE_SETUP +@@ -8400,9 +8381,9 @@ YY_RULE_SETUP YY_BREAK case 87: YY_RULE_SETUP -#line 729 "wcsulex.l" -+#line 726 "wcsulex.l" ++#line 713 "wcsulex.l" { - /* Parsec. */ + // Parsec. factor *= 3.0857e16; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); -@@ -8410,27 +8407,27 @@ YY_RULE_SETUP +@@ -8410,27 +8391,27 @@ YY_RULE_SETUP YY_BREAK case 88: YY_RULE_SETUP -#line 736 "wcsulex.l" -+#line 733 "wcsulex.l" ++#line 720 "wcsulex.l" { - /* Photon. */ + // Photon. @@ -11933,7 +13469,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 89: YY_RULE_SETUP -#line 742 "wcsulex.l" -+#line 739 "wcsulex.l" ++#line 726 "wcsulex.l" { - /* Pixel. */ + // Pixel. @@ -11944,55 +13480,55 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 90: YY_RULE_SETUP -#line 748 "wcsulex.l" -+#line 745 "wcsulex.l" ++#line 732 "wcsulex.l" { - /* Rayleigh. */ + // Rayleigh. factor *= 1e10 / (4.0 * PI); types[WCSUNITS_LENGTH] -= 2.0; types[WCSUNITS_TIME] -= 1.0; -@@ -8440,9 +8437,9 @@ YY_RULE_SETUP +@@ -8440,9 +8421,9 @@ YY_RULE_SETUP YY_BREAK case 91: YY_RULE_SETUP -#line 757 "wcsulex.l" -+#line 754 "wcsulex.l" ++#line 741 "wcsulex.l" { - /* Radian. */ + // Radian. factor *= 180.0 / PI; types[WCSUNITS_PLANE_ANGLE] += 1.0; BEGIN(EXPON); -@@ -8450,9 +8447,9 @@ YY_RULE_SETUP +@@ -8450,9 +8431,9 @@ YY_RULE_SETUP YY_BREAK case 92: YY_RULE_SETUP -#line 764 "wcsulex.l" -+#line 761 "wcsulex.l" ++#line 748 "wcsulex.l" { - /* Rydberg. */ + // Rydberg. factor *= 13.605692 * 1.6021765e-19; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; -@@ -8462,9 +8459,9 @@ YY_RULE_SETUP +@@ -8462,9 +8443,9 @@ YY_RULE_SETUP YY_BREAK case 93: YY_RULE_SETUP -#line 773 "wcsulex.l" -+#line 770 "wcsulex.l" ++#line 757 "wcsulex.l" { - /* Siemen. */ + // Siemen. types[WCSUNITS_MASS] -= 1.0; types[WCSUNITS_LENGTH] -= 2.0; types[WCSUNITS_TIME] += 1.0; -@@ -8474,18 +8471,18 @@ YY_RULE_SETUP +@@ -8474,18 +8455,18 @@ YY_RULE_SETUP YY_BREAK case 94: YY_RULE_SETUP -#line 782 "wcsulex.l" -+#line 779 "wcsulex.l" ++#line 766 "wcsulex.l" { - /* Second. */ + // Second. @@ -12003,43 +13539,43 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 95: YY_RULE_SETUP -#line 788 "wcsulex.l" -+#line 785 "wcsulex.l" ++#line 772 "wcsulex.l" { - /* Solar luminosity. */ + // Solar luminosity. factor *= 3.8268e26; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; -@@ -8495,9 +8492,9 @@ YY_RULE_SETUP +@@ -8495,9 +8476,9 @@ YY_RULE_SETUP YY_BREAK case 96: YY_RULE_SETUP -#line 797 "wcsulex.l" -+#line 794 "wcsulex.l" ++#line 781 "wcsulex.l" { - /* Solar mass. */ + // Solar mass. factor *= 1.9891e30; types[WCSUNITS_MASS] += 1.0; BEGIN(EXPON); -@@ -8505,9 +8502,9 @@ YY_RULE_SETUP +@@ -8505,9 +8486,9 @@ YY_RULE_SETUP YY_BREAK case 97: YY_RULE_SETUP -#line 804 "wcsulex.l" -+#line 801 "wcsulex.l" ++#line 788 "wcsulex.l" { - /* Solar radius. */ + // Solar radius. factor *= 6.9599e8; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); -@@ -8515,27 +8512,27 @@ YY_RULE_SETUP +@@ -8515,27 +8496,27 @@ YY_RULE_SETUP YY_BREAK case 98: YY_RULE_SETUP -#line 811 "wcsulex.l" -+#line 808 "wcsulex.l" ++#line 795 "wcsulex.l" { - /* Steradian. */ + // Steradian. @@ -12050,7 +13586,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 99: YY_RULE_SETUP -#line 817 "wcsulex.l" -+#line 814 "wcsulex.l" ++#line 801 "wcsulex.l" { - /* Sun (with respect to). */ + // Sun (with respect to). @@ -12061,55 +13597,55 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 100: YY_RULE_SETUP -#line 823 "wcsulex.l" -+#line 820 "wcsulex.l" ++#line 807 "wcsulex.l" { - /* Tesla. */ + // Tesla. types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_TIME] += 1.0; types[WCSUNITS_CHARGE] -= 1.0; -@@ -8544,9 +8541,9 @@ YY_RULE_SETUP +@@ -8544,9 +8525,9 @@ YY_RULE_SETUP YY_BREAK case 101: YY_RULE_SETUP -#line 831 "wcsulex.l" -+#line 828 "wcsulex.l" ++#line 815 "wcsulex.l" { - /* Turn. */ + // Turn. factor *= 360.0; types[WCSUNITS_PLANE_ANGLE] += 1.0; BEGIN(EXPON); -@@ -8554,9 +8551,9 @@ YY_RULE_SETUP +@@ -8554,9 +8535,9 @@ YY_RULE_SETUP YY_BREAK case 102: YY_RULE_SETUP -#line 838 "wcsulex.l" -+#line 835 "wcsulex.l" ++#line 822 "wcsulex.l" { - /* Unified atomic mass unit. */ + // Unified atomic mass unit. factor *= 1.6605387e-27; types[WCSUNITS_MASS] += 1.0; BEGIN(EXPON); -@@ -8564,9 +8561,9 @@ YY_RULE_SETUP +@@ -8564,9 +8545,9 @@ YY_RULE_SETUP YY_BREAK case 103: YY_RULE_SETUP -#line 845 "wcsulex.l" -+#line 842 "wcsulex.l" ++#line 829 "wcsulex.l" { - /* Volt. */ + // Volt. types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 1.0; types[WCSUNITS_TIME] -= 2.0; -@@ -8576,18 +8573,18 @@ YY_RULE_SETUP +@@ -8576,18 +8557,18 @@ YY_RULE_SETUP YY_BREAK case 104: YY_RULE_SETUP -#line 854 "wcsulex.l" -+#line 851 "wcsulex.l" ++#line 838 "wcsulex.l" { - /* Voxel. */ + // Voxel. @@ -12120,201 +13656,261 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsulex.c case 105: YY_RULE_SETUP -#line 860 "wcsulex.l" -+#line 857 "wcsulex.l" ++#line 844 "wcsulex.l" { - /* Watt. */ + // Watt. types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 3.0; -@@ -8596,9 +8593,9 @@ YY_RULE_SETUP +@@ -8596,9 +8577,9 @@ YY_RULE_SETUP YY_BREAK case 106: YY_RULE_SETUP -#line 868 "wcsulex.l" -+#line 865 "wcsulex.l" ++#line 852 "wcsulex.l" { - /* Weber. */ + // Weber. types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] += 1.0; -@@ -8608,9 +8605,9 @@ YY_RULE_SETUP +@@ -8608,9 +8589,9 @@ YY_RULE_SETUP YY_BREAK case 107: YY_RULE_SETUP -#line 877 "wcsulex.l" -+#line 874 "wcsulex.l" ++#line 861 "wcsulex.l" { - /* Internal parser error. */ + // Internal parser error. status = wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR), "Internal units parser error parsing '%s'", unitstr); BEGIN(FLUSH); -@@ -8618,9 +8615,9 @@ YY_RULE_SETUP +@@ -8618,9 +8599,9 @@ YY_RULE_SETUP YY_BREAK case 108: YY_RULE_SETUP -#line 884 "wcsulex.l" -+#line 881 "wcsulex.l" ++#line 868 "wcsulex.l" { - /* Exponentiation. */ + // Exponentiation. if (operator++) { BEGIN(FLUSH); } -@@ -8628,7 +8625,7 @@ YY_RULE_SETUP +@@ -8628,8 +8609,9 @@ YY_RULE_SETUP YY_BREAK case 109: YY_RULE_SETUP -#line 891 "wcsulex.l" -+#line 888 "wcsulex.l" ++#line 875 "wcsulex.l" { ++ int i; sscanf(yytext, " %d", &i); expon *= (double)i; -@@ -8639,7 +8636,7 @@ YY_RULE_SETUP + add(&factor, types, &expon, scale, units); +@@ -8639,8 +8621,9 @@ YY_RULE_SETUP YY_BREAK case 110: YY_RULE_SETUP -#line 899 "wcsulex.l" -+#line 896 "wcsulex.l" ++#line 884 "wcsulex.l" { ++ int i; sscanf(yytext, " (%d)", &i); expon *= (double)i; -@@ -8650,7 +8647,7 @@ YY_RULE_SETUP + add(&factor, types, &expon, scale, units); +@@ -8650,8 +8633,9 @@ YY_RULE_SETUP YY_BREAK case 111: YY_RULE_SETUP -#line 907 "wcsulex.l" -+#line 904 "wcsulex.l" ++#line 893 "wcsulex.l" { ++ int i, j; sscanf(yytext, " (%d/%d)", &i, &j); expon *= (double)i / (double)j; -@@ -8661,7 +8658,7 @@ YY_RULE_SETUP + add(&factor, types, &expon, scale, units); +@@ -8661,9 +8645,11 @@ YY_RULE_SETUP YY_BREAK case 112: YY_RULE_SETUP -#line 915 "wcsulex.l" -+#line 912 "wcsulex.l" ++#line 902 "wcsulex.l" { ++ char ctmp[72]; sscanf(yytext, " (%s)", ctmp); ++ double dexp; wcsutil_str2double(ctmp, &dexp); -@@ -8673,9 +8670,9 @@ YY_RULE_SETUP + expon *= dexp; + add(&factor, types, &expon, scale, units); +@@ -8673,9 +8659,9 @@ YY_RULE_SETUP YY_BREAK case 113: YY_RULE_SETUP -#line 924 "wcsulex.l" -+#line 921 "wcsulex.l" ++#line 913 "wcsulex.l" { - /* Multiply. */ + // Multiply. if (operator++) { BEGIN(FLUSH); } else { -@@ -8686,9 +8683,9 @@ YY_RULE_SETUP +@@ -8686,9 +8672,9 @@ YY_RULE_SETUP YY_BREAK case 114: YY_RULE_SETUP -#line 934 "wcsulex.l" -+#line 931 "wcsulex.l" ++#line 923 "wcsulex.l" { - /* Multiply. */ + // Multiply. if (operator) { BEGIN(FLUSH); } else { -@@ -8700,9 +8697,9 @@ YY_RULE_SETUP +@@ -8700,9 +8686,9 @@ YY_RULE_SETUP YY_BREAK case 115: YY_RULE_SETUP -#line 945 "wcsulex.l" -+#line 942 "wcsulex.l" ++#line 934 "wcsulex.l" { - /* Multiply. */ + // Multiply. if (operator) { BEGIN(FLUSH); } else { -@@ -8713,9 +8710,9 @@ YY_RULE_SETUP +@@ -8713,9 +8699,9 @@ YY_RULE_SETUP YY_BREAK case 116: YY_RULE_SETUP -#line 955 "wcsulex.l" -+#line 952 "wcsulex.l" ++#line 944 "wcsulex.l" { - /* Divide. */ + // Divide. if (operator++) { BEGIN(FLUSH); } else { -@@ -8727,7 +8724,7 @@ YY_RULE_SETUP +@@ -8727,7 +8713,7 @@ YY_RULE_SETUP YY_BREAK case 117: YY_RULE_SETUP -#line 966 "wcsulex.l" -+#line 963 "wcsulex.l" ++#line 955 "wcsulex.l" { add(&factor, types, &expon, scale, units); bracket = !bracket; -@@ -8736,7 +8733,7 @@ YY_RULE_SETUP +@@ -8736,7 +8722,7 @@ YY_RULE_SETUP YY_BREAK case 118: YY_RULE_SETUP -#line 972 "wcsulex.l" -+#line 969 "wcsulex.l" ++#line 961 "wcsulex.l" { status = wcserr_set(WCSERR_SET(UNITSERR_BAD_EXPON_SYMBOL), "Invalid symbol in EXPON context in '%s'", unitstr); -@@ -8745,9 +8742,9 @@ YY_RULE_SETUP +@@ -8745,9 +8731,9 @@ YY_RULE_SETUP YY_BREAK case 119: YY_RULE_SETUP -#line 978 "wcsulex.l" -+#line 975 "wcsulex.l" ++#line 967 "wcsulex.l" { - /* Discard any remaining input. */ + // Discard any remaining input. } YY_BREAK case YY_STATE_EOF(INITIAL): -@@ -8756,9 +8753,9 @@ case YY_STATE_EOF(PREFIX): +@@ -8756,9 +8742,9 @@ case YY_STATE_EOF(PREFIX): case YY_STATE_EOF(UNITS): case YY_STATE_EOF(EXPON): case YY_STATE_EOF(FLUSH): -#line 982 "wcsulex.l" -+#line 979 "wcsulex.l" ++#line 971 "wcsulex.l" { - /* End-of-string. */ + // End-of-string. if (YY_START == EXPON) { add(&factor, types, &expon, scale, units); } -@@ -8793,10 +8790,10 @@ case YY_STATE_EOF(FLUSH): +@@ -8782,7 +8768,7 @@ case YY_STATE_EOF(FLUSH): + } + + if (status) { +- for (i = 0; i < WCSUNITS_NTYPE; i++) { ++ for (int i = 0; i < WCSUNITS_NTYPE; i++) { + units[i] = 0.0; + *scale = 0.0; + } +@@ -8793,10 +8779,10 @@ case YY_STATE_EOF(FLUSH): YY_BREAK case 120: YY_RULE_SETUP -#line 1016 "wcsulex.l" -+#line 1013 "wcsulex.l" ++#line 1005 "wcsulex.l" ECHO; YY_BREAK -#line 8800 "wcsulex.c" -+#line 8797 "wcsulex.c" ++#line 8786 "wcsulex.c" case YY_END_OF_BUFFER: { -@@ -9961,7 +9958,7 @@ void yyfree (void * ptr , yyscan_t yysca +@@ -9961,7 +9947,35 @@ void yyfree (void * ptr , yyscan_t yysca #define YYTABLES_NAME "yytables" -#line 1016 "wcsulex.l" -+#line 1013 "wcsulex.l" ++#line 1005 "wcsulex.l" ++ ++ ++/*---------------------------------------------------------------------------- ++* External interface to the scanner. ++*---------------------------------------------------------------------------*/ ++ ++int wcsulexe( ++ const char unitstr[], ++ int *func, ++ double *scale, ++ double units[WCSUNITS_NTYPE], ++ struct wcserr **err) ++ ++{ ++ static const char *function = "wcsulexe"; ++ ++ // Function prototypes. ++ int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner); ++ int yylex_destroy(yyscan_t yyscanner); ++ ++ struct wcsulex_extra extra; ++ yyscan_t yyscanner; ++ yylex_init_extra(&extra, &yyscanner); ++ int status = wcsulexe_scanner(unitstr, func, scale, units, err, yyscanner); ++ yylex_destroy(yyscanner); ++ ++ return status; ++} /*---------------------------------------------------------------------------- -Index: astropy-4.2/cextern/wcslib/C/flexed/wcsutrn.c +@@ -9976,11 +9990,9 @@ void add( + double units[]) + + { +- int i; +- + *scale *= pow(*factor, *expon); + +- for (i = 0; i < WCSUNITS_NTYPE; i++) { ++ for (int i = 0; i < WCSUNITS_NTYPE; i++) { + units[i] += *expon * types[i]; + types[i] = 0.0; + } +Index: astropy-4.2.1/cextern/wcslib/C/flexed/wcsutrn.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/flexed/wcsutrn.c -+++ astropy-4.2/cextern/wcslib/C/flexed/wcsutrn.c +--- astropy-4.2.1.orig/cextern/wcslib/C/flexed/wcsutrn.c ++++ astropy-4.2.1/cextern/wcslib/C/flexed/wcsutrn.c @@ -724,7 +724,7 @@ static const flex_int16_t yy_nxt[][128] 43, -10, -10, -10, -10, -10, -10, 43, 43, 43, @@ -14654,7 +16250,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsutrn.c - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -14668,7 +16264,7 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsutrn.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsutrn.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcsutrn.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcsutrn.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * * wcsutrn.l is a Flex description file containing the definition of a lexical @@ -14677,25 +16273,43 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsutrn.c /* Exclusive start states. */ -#line 51 "wcsutrn.l" -+#line 48 "wcsutrn.l" ++#line 49 "wcsutrn.l" #include #include #include -@@ -4292,7 +4430,7 @@ static const yy_state_type yy_NUL_trans[ - static int wcsutrne_scanner(int ctrl, char unitstr[], struct wcserr **err, - yyscan_t yyscanner); +@@ -4289,43 +4427,26 @@ static const yy_state_type yy_NUL_trans[ + #include "wcserr.h" + #include "wcsunits.h" +-static int wcsutrne_scanner(int ctrl, char unitstr[], struct wcserr **err, +- yyscan_t yyscanner); +- -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- - - int wcsutrne( - int ctrl, -@@ -4312,20 +4450,20 @@ int wcsutrne( - return status; - } - +- +-int wcsutrne( +- int ctrl, +- char unitstr[], +- struct wcserr **err) +- +-{ +- int status; +- yyscan_t yyscanner; +- int yylex_init(yyscan_t *yyscanner); +- int yylex_destroy(yyscan_t yyscanner); +- +- yylex_init(&yyscanner); +- status = wcsutrne_scanner(ctrl, unitstr, err, yyscanner); +- yylex_destroy(yyscanner); +- +- return status; +-} +- -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- ++// User data associated with yyscanner. ++struct wcsutrn_extra { ++ // Used in preempting the call to exit() by yy_fatal_error(). ++ jmp_buf abort_jmp_env; ++}; #define YY_DECL int wcsutrne_scanner(int ctrl, char unitstr[], \ struct wcserr **err, yyscan_t yyscanner) @@ -14705,53 +16319,88 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsutrn.c #define YY_INPUT(inbuff, count, bufsize) { count = YY_NULL; } -/* Used in preempting the call to exit() by yy_fatal_error(). */ -+// Used in preempting the call to exit() by yy_fatal_error(). - jmp_buf wcsutrn_abort_jmp_env; - #define exit(status) longjmp(wcsutrn_abort_jmp_env, status) +-jmp_buf wcsutrn_abort_jmp_env; +-#define exit(status) longjmp(wcsutrn_abort_jmp_env, status) ++// Preempt the call to exit() by yy_fatal_error(). ++#define exit(status) longjmp(yyextra->abort_jmp_env, status); ++ ++// Internal helper functions. ++static YY_DECL; -#line 4328 "wcsutrn.c" -#line 4329 "wcsutrn.c" -+#line 4466 "wcsutrn.c" -+#line 4467 "wcsutrn.c" ++#line 4449 "wcsutrn.c" ++#line 4450 "wcsutrn.c" #define INITIAL 0 #define NEXT 1 -@@ -4574,9 +4712,9 @@ YY_DECL +@@ -4339,9 +4460,7 @@ jmp_buf wcsutrn_abort_jmp_env; + #include + #endif + +-#ifndef YY_EXTRA_TYPE +-#define YY_EXTRA_TYPE void * +-#endif ++#define YY_EXTRA_TYPE struct wcsutrn_extra * + + /* Holds the entire state of the reentrant scanner. */ + struct yyguts_t +@@ -4574,29 +4693,29 @@ YY_DECL } { -#line 96 "wcsutrn.l" -+#line 93 "wcsutrn.l" ++#line 77 "wcsutrn.l" -#line 98 "wcsutrn.l" -+#line 95 "wcsutrn.l" - static const char *function = "wcsutrne"; +- static const char *function = "wcsutrne"; +- +- char orig[80], subs[80]; +- int bracket = 0; +- int unsafe = 0; +- int status = -1; ++#line 79 "wcsutrn.l" ++ static const char *function = "wcsutrne_scanner"; - char orig[80], subs[80]; -@@ -4593,7 +4731,7 @@ YY_DECL + if (err) *err = 0x0; + ++ char orig[80], subs[80]; + *orig = '\0'; + *subs = '\0'; + ++ int bracket = 0; ++ int unsafe = 0; ++ int status = -1; ++ + yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner); yy_scan_string(unitstr, yyscanner); *unitstr = '\0'; - /* Return here via longjmp() invoked by yy_fatal_error(). */ +- if (setjmp(wcsutrn_abort_jmp_env)) { + // Return here via longjmp() invoked by yy_fatal_error(). - if (setjmp(wcsutrn_abort_jmp_env)) { ++ if (setjmp(yyextra->abort_jmp_env)) { return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR), - "Internal units translator error parsing '%s'", unitstr); -@@ -4605,7 +4743,7 @@ YY_DECL +- "Internal units translator error parsing '%s'", unitstr); ++ "Internal units translator error"); + } + + BEGIN(INITIAL); +@@ -4605,7 +4724,7 @@ YY_DECL fprintf(stderr, "\n%s ->\n", unitstr); #endif -#line 4609 "wcsutrn.c" -+#line 4747 "wcsutrn.c" ++#line 4728 "wcsutrn.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { -@@ -4638,24 +4776,24 @@ do_action: /* This label is used only to +@@ -4638,24 +4757,24 @@ do_action: /* This label is used only to { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 126 "wcsutrn.l" -+#line 123 "wcsutrn.l" ++#line 107 "wcsutrn.l" { - /* Looks like a keycomment. */ + // Looks like a keycomment. @@ -14763,293 +16412,293 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsutrn.c YY_RULE_SETUP -#line 132 "wcsutrn.l" -/* Discard leading whitespace. */ -+#line 129 "wcsutrn.l" ++#line 113 "wcsutrn.l" +// Discard leading whitespace. YY_BREAK case 3: /* rule 3 can match eol */ YY_RULE_SETUP -#line 134 "wcsutrn.l" -+#line 131 "wcsutrn.l" ++#line 115 "wcsutrn.l" { - /* Non-alphabetic character. */ + // Non-alphabetic character. strcat(unitstr, yytext); if (bracket && *yytext == ']') { BEGIN(FLUSH); -@@ -4664,7 +4802,7 @@ YY_RULE_SETUP +@@ -4664,7 +4783,7 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 142 "wcsutrn.l" -+#line 139 "wcsutrn.l" ++#line 123 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "Angstrom"); -@@ -4673,7 +4811,7 @@ YY_RULE_SETUP +@@ -4673,7 +4792,7 @@ YY_RULE_SETUP YY_BREAK case 5: YY_RULE_SETUP -#line 148 "wcsutrn.l" -+#line 145 "wcsutrn.l" ++#line 129 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "arcmin"); -@@ -4682,7 +4820,7 @@ YY_RULE_SETUP +@@ -4682,7 +4801,7 @@ YY_RULE_SETUP YY_BREAK case 6: YY_RULE_SETUP -#line 154 "wcsutrn.l" -+#line 151 "wcsutrn.l" ++#line 135 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "arcsec"); -@@ -4691,7 +4829,7 @@ YY_RULE_SETUP +@@ -4691,7 +4810,7 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 160 "wcsutrn.l" -+#line 157 "wcsutrn.l" ++#line 141 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "beam"); -@@ -4700,7 +4838,7 @@ YY_RULE_SETUP +@@ -4700,7 +4819,7 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 166 "wcsutrn.l" -+#line 163 "wcsutrn.l" ++#line 147 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "byte"); -@@ -4709,7 +4847,7 @@ YY_RULE_SETUP +@@ -4709,7 +4828,7 @@ YY_RULE_SETUP YY_BREAK case 9: YY_RULE_SETUP -#line 172 "wcsutrn.l" -+#line 169 "wcsutrn.l" ++#line 153 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "d"); -@@ -4718,7 +4856,7 @@ YY_RULE_SETUP +@@ -4718,7 +4837,7 @@ YY_RULE_SETUP YY_BREAK case 10: YY_RULE_SETUP -#line 178 "wcsutrn.l" -+#line 175 "wcsutrn.l" ++#line 159 "wcsutrn.l" { unsafe = 1; strcpy(orig, yytext); -@@ -4728,7 +4866,7 @@ YY_RULE_SETUP +@@ -4728,7 +4847,7 @@ YY_RULE_SETUP YY_BREAK case 11: YY_RULE_SETUP -#line 185 "wcsutrn.l" -+#line 182 "wcsutrn.l" ++#line 166 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "deg"); -@@ -4737,7 +4875,7 @@ YY_RULE_SETUP +@@ -4737,7 +4856,7 @@ YY_RULE_SETUP YY_BREAK case 12: YY_RULE_SETUP -#line 191 "wcsutrn.l" -+#line 188 "wcsutrn.l" ++#line 172 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "GHz"); -@@ -4746,7 +4884,7 @@ YY_RULE_SETUP +@@ -4746,7 +4865,7 @@ YY_RULE_SETUP YY_BREAK case 13: YY_RULE_SETUP -#line 197 "wcsutrn.l" -+#line 194 "wcsutrn.l" ++#line 178 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "h"); -@@ -4755,7 +4893,7 @@ YY_RULE_SETUP +@@ -4755,7 +4874,7 @@ YY_RULE_SETUP YY_BREAK case 14: YY_RULE_SETUP -#line 203 "wcsutrn.l" -+#line 200 "wcsutrn.l" ++#line 184 "wcsutrn.l" { unsafe = 1; strcpy(orig, yytext); -@@ -4765,7 +4903,7 @@ YY_RULE_SETUP +@@ -4765,7 +4884,7 @@ YY_RULE_SETUP YY_BREAK case 15: YY_RULE_SETUP -#line 210 "wcsutrn.l" -+#line 207 "wcsutrn.l" ++#line 191 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "Hz"); -@@ -4774,7 +4912,7 @@ YY_RULE_SETUP +@@ -4774,7 +4893,7 @@ YY_RULE_SETUP YY_BREAK case 16: YY_RULE_SETUP -#line 216 "wcsutrn.l" -+#line 213 "wcsutrn.l" ++#line 197 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "kHz"); -@@ -4783,7 +4921,7 @@ YY_RULE_SETUP +@@ -4783,7 +4902,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 222 "wcsutrn.l" -+#line 219 "wcsutrn.l" ++#line 203 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "Jy"); -@@ -4792,7 +4930,7 @@ YY_RULE_SETUP +@@ -4792,7 +4911,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 228 "wcsutrn.l" -+#line 225 "wcsutrn.l" ++#line 209 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "K"); -@@ -4801,7 +4939,7 @@ YY_RULE_SETUP +@@ -4801,7 +4920,7 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 234 "wcsutrn.l" -+#line 231 "wcsutrn.l" ++#line 215 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "km"); -@@ -4810,7 +4948,7 @@ YY_RULE_SETUP +@@ -4810,7 +4929,7 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 240 "wcsutrn.l" -+#line 237 "wcsutrn.l" ++#line 221 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "m"); -@@ -4819,7 +4957,7 @@ YY_RULE_SETUP +@@ -4819,7 +4938,7 @@ YY_RULE_SETUP YY_BREAK case 21: YY_RULE_SETUP -#line 246 "wcsutrn.l" -+#line 243 "wcsutrn.l" ++#line 227 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "min"); -@@ -4828,7 +4966,7 @@ YY_RULE_SETUP +@@ -4828,7 +4947,7 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 252 "wcsutrn.l" -+#line 249 "wcsutrn.l" ++#line 233 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "MHz"); -@@ -4837,7 +4975,7 @@ YY_RULE_SETUP +@@ -4837,7 +4956,7 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 258 "wcsutrn.l" -+#line 255 "wcsutrn.l" ++#line 239 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "ohm"); -@@ -4846,7 +4984,7 @@ YY_RULE_SETUP +@@ -4846,7 +4965,7 @@ YY_RULE_SETUP YY_BREAK case 24: YY_RULE_SETUP -#line 264 "wcsutrn.l" -+#line 261 "wcsutrn.l" ++#line 245 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "Pa"); -@@ -4855,7 +4993,7 @@ YY_RULE_SETUP +@@ -4855,7 +4974,7 @@ YY_RULE_SETUP YY_BREAK case 25: YY_RULE_SETUP -#line 270 "wcsutrn.l" -+#line 267 "wcsutrn.l" ++#line 251 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "pixel"); -@@ -4864,7 +5002,7 @@ YY_RULE_SETUP +@@ -4864,7 +4983,7 @@ YY_RULE_SETUP YY_BREAK case 26: YY_RULE_SETUP -#line 276 "wcsutrn.l" -+#line 273 "wcsutrn.l" ++#line 257 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "rad"); -@@ -4873,7 +5011,7 @@ YY_RULE_SETUP +@@ -4873,7 +4992,7 @@ YY_RULE_SETUP YY_BREAK case 27: YY_RULE_SETUP -#line 282 "wcsutrn.l" -+#line 279 "wcsutrn.l" ++#line 263 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "s"); -@@ -4882,7 +5020,7 @@ YY_RULE_SETUP +@@ -4882,7 +5001,7 @@ YY_RULE_SETUP YY_BREAK case 28: YY_RULE_SETUP -#line 288 "wcsutrn.l" -+#line 285 "wcsutrn.l" ++#line 269 "wcsutrn.l" { unsafe = 1; strcpy(orig, yytext); -@@ -4892,7 +5030,7 @@ YY_RULE_SETUP +@@ -4892,7 +5011,7 @@ YY_RULE_SETUP YY_BREAK case 29: YY_RULE_SETUP -#line 295 "wcsutrn.l" -+#line 292 "wcsutrn.l" ++#line 276 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "V"); -@@ -4901,7 +5039,7 @@ YY_RULE_SETUP +@@ -4901,7 +5020,7 @@ YY_RULE_SETUP YY_BREAK case 30: YY_RULE_SETUP -#line 301 "wcsutrn.l" -+#line 298 "wcsutrn.l" ++#line 282 "wcsutrn.l" { strcpy(orig, yytext); strcpy(subs, "yr"); -@@ -4910,9 +5048,9 @@ YY_RULE_SETUP +@@ -4910,9 +5029,9 @@ YY_RULE_SETUP YY_BREAK case 31: YY_RULE_SETUP -#line 307 "wcsutrn.l" -+#line 304 "wcsutrn.l" ++#line 288 "wcsutrn.l" { - /* Not a recognized alias. */ + // Not a recognized alias. strcpy(orig, yytext); strcpy(subs, orig); BEGIN(NEXT); -@@ -4920,9 +5058,9 @@ YY_RULE_SETUP +@@ -4920,9 +5039,9 @@ YY_RULE_SETUP YY_BREAK case 32: YY_RULE_SETUP -#line 314 "wcsutrn.l" -+#line 311 "wcsutrn.l" ++#line 295 "wcsutrn.l" { - /* Reject the alias match. */ + // Reject the alias match. strcat(orig, yytext); strcpy(subs, orig); } -@@ -4930,17 +5068,17 @@ YY_RULE_SETUP +@@ -4930,17 +5049,17 @@ YY_RULE_SETUP case 33: /* rule 33 can match eol */ YY_RULE_SETUP -#line 320 "wcsutrn.l" -+#line 317 "wcsutrn.l" ++#line 301 "wcsutrn.l" { - /* Discard separating whitespace. */ + // Discard separating whitespace. @@ -15059,31 +16708,31 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsutrn.c case 34: YY_RULE_SETUP -#line 325 "wcsutrn.l" -+#line 322 "wcsutrn.l" ++#line 306 "wcsutrn.l" { - /* Compress separating whitespace. */ + // Compress separating whitespace. strcat(unitstr, subs); strcat(unitstr, " "); if (strcmp(orig, subs)) status = 0; -@@ -4951,9 +5089,9 @@ YY_RULE_SETUP +@@ -4951,9 +5070,9 @@ YY_RULE_SETUP YY_BREAK case 35: YY_RULE_SETUP -#line 335 "wcsutrn.l" -+#line 332 "wcsutrn.l" ++#line 316 "wcsutrn.l" { - /* Copy anything else unchanged. */ + // Copy anything else unchanged. strcat(unitstr, subs); if (strcmp(orig, subs)) status = 0; unput(*yytext); -@@ -4963,18 +5101,18 @@ YY_RULE_SETUP +@@ -4963,18 +5082,18 @@ YY_RULE_SETUP YY_BREAK case 36: YY_RULE_SETUP -#line 344 "wcsutrn.l" -+#line 341 "wcsutrn.l" ++#line 325 "wcsutrn.l" { - /* Copy out remaining input. */ + // Copy out remaining input. @@ -15094,44 +16743,69 @@ Index: astropy-4.2/cextern/wcslib/C/flexed/wcsutrn.c case YY_STATE_EOF(NEXT): case YY_STATE_EOF(FLUSH): -#line 349 "wcsutrn.l" -+#line 346 "wcsutrn.l" ++#line 330 "wcsutrn.l" { - /* End-of-string. */ + // End-of-string. if (*subs) { strcat(unitstr, subs); if (strcmp(orig, subs)) status = 0; -@@ -4989,10 +5127,10 @@ case YY_STATE_EOF(FLUSH): +@@ -4989,10 +5108,10 @@ case YY_STATE_EOF(FLUSH): YY_BREAK case 37: YY_RULE_SETUP -#line 363 "wcsutrn.l" -+#line 360 "wcsutrn.l" ++#line 344 "wcsutrn.l" ECHO; YY_BREAK -#line 4996 "wcsutrn.c" -+#line 5134 "wcsutrn.c" ++#line 5115 "wcsutrn.c" case YY_END_OF_BUFFER: { -@@ -6142,6 +6280,6 @@ void yyfree (void * ptr , yyscan_t yysca +@@ -6142,6 +6261,31 @@ void yyfree (void * ptr , yyscan_t yysca #define YYTABLES_NAME "yytables" -#line 363 "wcsutrn.l" -+#line 360 "wcsutrn.l" ++#line 344 "wcsutrn.l" ++ ++/*---------------------------------------------------------------------------- ++* External interface to the scanner. ++*---------------------------------------------------------------------------*/ ++ ++int wcsutrne( ++ int ctrl, ++ char unitstr[], ++ struct wcserr **err) ++ ++{ ++ static const char *function = "wcsutrne"; ++ ++ // Function prototypes. ++ int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner); ++ int yylex_destroy(yyscan_t yyscanner); ++ ++ struct wcsutrn_extra extra; ++ yyscan_t yyscanner; ++ yylex_init_extra(&extra, &yyscanner); ++ int status = wcsutrne_scanner(ctrl, unitstr, err, yyscanner); ++ yylex_destroy(yyscanner); ++ ++ return status; ++} -Index: astropy-4.2/cextern/wcslib/C/getwcstab.c +Index: astropy-4.2.1/cextern/wcslib/C/getwcstab.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/getwcstab.c -+++ astropy-4.2/cextern/wcslib/C/getwcstab.c +--- astropy-4.2.1.orig/cextern/wcslib/C/getwcstab.c ++++ astropy-4.2.1/cextern/wcslib/C/getwcstab.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -15145,7 +16819,7 @@ Index: astropy-4.2/cextern/wcslib/C/getwcstab.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: getwcstab.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: getwcstab.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: getwcstab.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -15253,16 +16927,16 @@ Index: astropy-4.2/cextern/wcslib/C/getwcstab.c if (naxes) free(naxes); if (*status) { wtbp = wtb; -Index: astropy-4.2/cextern/wcslib/C/getwcstab.h +Index: astropy-4.2.1/cextern/wcslib/C/getwcstab.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/getwcstab.h -+++ astropy-4.2/cextern/wcslib/C/getwcstab.h +--- astropy-4.2.1.orig/cextern/wcslib/C/getwcstab.h ++++ astropy-4.2.1/cextern/wcslib/C/getwcstab.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -15276,11 +16950,11 @@ Index: astropy-4.2/cextern/wcslib/C/getwcstab.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: getwcstab.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: getwcstab.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: getwcstab.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * @@ -15416,21 +17090,21 @@ Index: astropy-4.2/cextern/wcslib/C/getwcstab.h -#endif /* WCSLIB_GETWCSTAB */ +#endif // WCSLIB_GETWCSTAB -Index: astropy-4.2/cextern/wcslib/C/lin.c +Index: astropy-4.2.1/cextern/wcslib/C/lin.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/lin.c -+++ astropy-4.2/cextern/wcslib/C/lin.c +--- astropy-4.2.1.orig/cextern/wcslib/C/lin.c ++++ astropy-4.2.1/cextern/wcslib/C/lin.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. -@@ -18,11 +17,9 @@ +@@ -18,17 +17,15 @@ You should have received a copy of the GNU Lesser General Public License along with WCSLIB. If not, see http://www.gnu.org/licenses. @@ -15439,10 +17113,17 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: lin.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: lin.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: lin.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ ++#include #include + #include + #include +-#include + + #include "wcserr.h" + #include "wcsprintf.h" @@ -37,7 +34,7 @@ const int LINSET = 137; @@ -15649,16 +17330,74 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c if (lin->piximg) free(lin->piximg); if (lin->imgpix) free(lin->imgpix); if (lin->tmpcrd) free(lin->tmpcrd); -@@ -443,7 +440,7 @@ int linfree(struct linprm *lin) +@@ -443,7 +440,65 @@ int linfree(struct linprm *lin) return 0; } -/*--------------------------------------------------------------------------*/ ++//---------------------------------------------------------------------------- ++ ++int linsize(const struct linprm *lin, int sizes[2]) ++ ++{ ++ ++ if (lin == 0x0) { ++ sizes[0] = sizes[1] = 0; ++ return LINERR_SUCCESS; ++ } ++ ++ // Base size, in bytes. ++ sizes[0] = sizeof(struct linprm); ++ ++ // Total size of allocated memory, in bytes. ++ sizes[1] = 0; ++ ++ int exsizes[2]; ++ int naxis = lin->naxis; ++ ++ // linprm::crpix[]. ++ sizes[1] += naxis * sizeof(double); ++ ++ // linprm::pc[]. ++ sizes[1] += naxis*naxis * sizeof(double); ++ ++ // linprm::cdelt[]. ++ sizes[1] += naxis * sizeof(double); ++ ++ // linprm::dispre[]. ++ dissize(lin->dispre, exsizes); ++ sizes[2] += exsizes[0] + exsizes[1]; ++ ++ // linprm::disseq[]. ++ dissize(lin->disseq, exsizes); ++ sizes[2] += exsizes[0] + exsizes[1]; ++ ++ // linprm::err[]. ++ wcserr_size(lin->err, exsizes); ++ sizes[1] += exsizes[0] + exsizes[1]; ++ ++ // The remaining arrays are allocated unconditionally by linset(). ++ if (lin->flag != LINSET) { ++ return LINERR_SUCCESS; ++ } ++ ++ // linprm::piximg[]. ++ sizes[1] += naxis*naxis * sizeof(double); ++ ++ // linprm::imgpix[]. ++ sizes[1] += naxis*naxis * sizeof(double); ++ ++ // linprm::tmpcrd[]. ++ sizes[1] += naxis * sizeof(double); ++ ++ return LINERR_SUCCESS; ++} ++ +//---------------------------------------------------------------------------- int linprt(const struct linprm *lin) -@@ -458,7 +455,7 @@ int linprt(const struct linprm *lin) +@@ -458,7 +513,7 @@ int linprt(const struct linprm *lin) } wcsprintf(" flag: %d\n", lin->flag); @@ -15667,7 +17406,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c wcsprintf(" naxis: %d\n", lin->naxis); WCSPRINTF_PTR(" crpix: ", lin->crpix, "\n"); -@@ -492,7 +489,7 @@ int linprt(const struct linprm *lin) +@@ -492,7 +547,7 @@ int linprt(const struct linprm *lin) if (lin->disseq != 0x0) wcsprintf(" (see below)"); wcsprintf("\n"); @@ -15676,7 +17415,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c if (lin->piximg == 0x0) { wcsprintf(" piximg: (nil)\n"); } else { -@@ -524,16 +521,16 @@ int linprt(const struct linprm *lin) +@@ -524,16 +579,16 @@ int linprt(const struct linprm *lin) wcsprintf(" affine: %d\n", lin->affine); wcsprintf(" simple: %d\n", lin->simple); @@ -15696,7 +17435,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c wcsprintf(" m_flag: %d\n", lin->m_flag); wcsprintf(" m_naxis: %d\n", lin->m_naxis); WCSPRINTF_PTR(" m_crpix: ", lin->m_crpix, ""); -@@ -552,7 +549,7 @@ int linprt(const struct linprm *lin) +@@ -552,7 +607,7 @@ int linprt(const struct linprm *lin) if (lin->disseq && lin->m_disseq == lin->disseq) wcsprintf(" (= disseq)"); wcsprintf("\n"); @@ -15705,7 +17444,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c if (lin->dispre) { wcsprintf("\n"); wcsprintf("dispre.*\n"); -@@ -568,7 +565,7 @@ int linprt(const struct linprm *lin) +@@ -568,7 +623,7 @@ int linprt(const struct linprm *lin) return 0; } @@ -15714,7 +17453,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c int linperr(const struct linprm *lin, const char *prefix) -@@ -583,7 +580,7 @@ int linperr(const struct linprm *lin, co +@@ -583,7 +638,7 @@ int linperr(const struct linprm *lin, co return 0; } @@ -15723,7 +17462,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c int linset(struct linprm *lin) -@@ -599,7 +596,7 @@ int linset(struct linprm *lin) +@@ -599,7 +654,7 @@ int linset(struct linprm *lin) naxis = lin->naxis; @@ -15732,7 +17471,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c lin->unity = 1; pc = lin->pc; for (i = 0; i < naxis; i++) { -@@ -621,7 +618,7 @@ int linset(struct linprm *lin) +@@ -621,7 +676,7 @@ int linset(struct linprm *lin) if (lin->unity) { if (lin->flag == LINSET) { @@ -15741,7 +17480,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c if (lin->piximg) free(lin->piximg); if (lin->imgpix) free(lin->imgpix); } -@@ -630,7 +627,7 @@ int linset(struct linprm *lin) +@@ -630,7 +685,7 @@ int linset(struct linprm *lin) lin->imgpix = 0x0; lin->i_naxis = 0; @@ -15750,7 +17489,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c for (i = 0; i < naxis; i++) { if (lin->cdelt[i] == 0.0) { return wcserr_set(LIN_ERRMSG(LINERR_SINGULAR_MTX)); -@@ -640,12 +637,12 @@ int linset(struct linprm *lin) +@@ -640,12 +695,12 @@ int linset(struct linprm *lin) } else { if (lin->flag != LINSET || lin->i_naxis < naxis) { if (lin->flag == LINSET) { @@ -15765,7 +17504,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c if ((lin->piximg = calloc(naxis*naxis, sizeof(double))) == 0x0) { return wcserr_set(LIN_ERRMSG(LINERR_MEMORY)); } -@@ -658,28 +655,30 @@ int linset(struct linprm *lin) +@@ -658,28 +713,30 @@ int linset(struct linprm *lin) lin->i_naxis = naxis; } @@ -15803,7 +17542,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c lin->affine = 1; if (lin->dispre) { if ((status = disset(lin->dispre))) { -@@ -700,7 +699,7 @@ int linset(struct linprm *lin) +@@ -700,7 +757,7 @@ int linset(struct linprm *lin) lin->simple = lin->unity && lin->affine; @@ -15812,7 +17551,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c if (lin->tmpcrd) free(lin->tmpcrd); if ((lin->tmpcrd = calloc(naxis, sizeof(double))) == 0x0) { linfree(lin); -@@ -713,7 +712,7 @@ int linset(struct linprm *lin) +@@ -713,7 +770,7 @@ int linset(struct linprm *lin) return 0; } @@ -15821,7 +17560,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c int linp2x( struct linprm *lin, -@@ -732,7 +731,7 @@ int linp2x( +@@ -732,7 +789,7 @@ int linp2x( struct wcserr **err; @@ -15830,7 +17569,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c if (lin == 0x0) return LINERR_NULL_POINTER; err = &(lin->err); -@@ -743,12 +742,12 @@ int linp2x( +@@ -743,12 +800,12 @@ int linp2x( n = lin->naxis; @@ -15845,7 +17584,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c nelemn = nelem - n; for (k = 0; k < ncoord; k++) { for (i = 0; i < n; i++) { -@@ -760,17 +759,17 @@ int linp2x( +@@ -760,17 +817,17 @@ int linp2x( } } else if (lin->affine) { @@ -15866,7 +17605,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c temp = *(pix++) - lin->crpix[j]; for (i = 0; i < n; i++, piximg += n) { img[i] += *piximg * temp; -@@ -782,7 +781,7 @@ int linp2x( +@@ -782,7 +839,7 @@ int linp2x( } } else { @@ -15875,7 +17614,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c ndbl = n * sizeof(double); tmp = lin->tmpcrd; -@@ -819,13 +818,13 @@ int linp2x( +@@ -819,13 +876,13 @@ int linp2x( return wcserr_set(LIN_ERRMSG(lin_diserr[status])); } @@ -15891,7 +17630,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c for (i = 0; i < n; i++) { img[i] *= lin->cdelt[i]; } -@@ -839,7 +838,7 @@ int linp2x( +@@ -839,7 +896,7 @@ int linp2x( return 0; } @@ -15900,7 +17639,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c int linx2p( struct linprm *lin, -@@ -857,7 +856,7 @@ int linx2p( +@@ -857,7 +914,7 @@ int linx2p( struct wcserr **err; @@ -15909,7 +17648,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c if (lin == 0x0) return LINERR_NULL_POINTER; err = &(lin->err); -@@ -868,12 +867,12 @@ int linx2p( +@@ -868,12 +925,12 @@ int linx2p( n = lin->naxis; @@ -15924,7 +17663,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c nelemn = nelem - n; for (k = 0; k < ncoord; k++) { for (j = 0; j < n; j++) { -@@ -885,10 +884,10 @@ int linx2p( +@@ -885,10 +942,10 @@ int linx2p( } } else if (lin->affine) { @@ -15937,7 +17676,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c imgpix = lin->imgpix; for (j = 0; j < n; j++) { -@@ -906,13 +905,13 @@ int linx2p( +@@ -906,13 +963,13 @@ int linx2p( } } else { @@ -15953,7 +17692,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c for (i = 0; i < n; i++) { tmp[i] = img[i] / lin->cdelt[i]; } -@@ -924,13 +923,13 @@ int linx2p( +@@ -924,13 +981,13 @@ int linx2p( memcpy(tmp, pix, ndbl); } else if (lin->unity) { @@ -15969,7 +17708,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c memcpy(tmp, img, ndbl); } -@@ -965,7 +964,7 @@ int linx2p( +@@ -965,7 +1022,7 @@ int linx2p( return 0; } @@ -15978,7 +17717,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c int linwarp( struct linprm *lin, -@@ -990,7 +989,7 @@ int linwarp( +@@ -990,7 +1047,7 @@ int linwarp( struct wcserr **err; @@ -15987,7 +17726,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c if (lin == 0x0) return LINERR_NULL_POINTER; err = &(lin->err); -@@ -1006,17 +1005,17 @@ int linwarp( +@@ -1006,17 +1063,17 @@ int linwarp( if (avgtot) *avgtot = 0.0; if (rmstot) *rmstot = 0.0; @@ -16008,7 +17747,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c affine.flag = -1; if ((status = (lincpy(1, lin, &affine) || lindist(1, &affine, 0x0, 0) || -@@ -1025,7 +1024,7 @@ int linwarp( +@@ -1025,7 +1082,7 @@ int linwarp( return wcserr_set(LIN_ERRMSG(status)); } @@ -16017,7 +17756,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c pixinc = lin->tmpcrd; ncoord = 0; for (j = 0; j < naxis; j++) { -@@ -1044,12 +1043,12 @@ int linwarp( +@@ -1044,12 +1101,12 @@ int linwarp( } if (j == 0) { @@ -16032,7 +17771,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c if ((pix0 = calloc((3*ncoord+4)*naxis, sizeof(double))) == 0x0) { return wcserr_set(LIN_ERRMSG(LINERR_MEMORY)); } -@@ -1062,10 +1061,10 @@ int linwarp( +@@ -1062,10 +1119,10 @@ int linwarp( ssqdis = sumdis + naxis; @@ -16045,7 +17784,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c for (j = 0; j < naxis; j++) { pix0[j] = pixblc ? pixblc[j] : 1.0; pixend[j] = pixtrc[j] + 0.5*pixinc[j]; -@@ -1080,7 +1079,7 @@ int linwarp( +@@ -1080,7 +1137,7 @@ int linwarp( } } @@ -16054,7 +17793,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c for (j = 0; j < naxis; j++) { sumdis[j] = 0.0; ssqdis[j] = 0.0; -@@ -1089,20 +1088,20 @@ int linwarp( +@@ -1089,20 +1146,20 @@ int linwarp( ssqtot = 0.0; @@ -16079,7 +17818,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c pix0p = pix0; pix1p = pix1; for (i = 0; i < ncoord; i++) { -@@ -1128,7 +1127,7 @@ int linwarp( +@@ -1128,7 +1185,7 @@ int linwarp( if (maxtot && *maxtot < totdis) *maxtot = totdis; } @@ -16088,7 +17827,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c for (j = 1; j < naxis; j++) { pix0[j] += pixinc[j]; if ((carry = (pix0[j] > pixend[j]))) { -@@ -1146,7 +1145,7 @@ int linwarp( +@@ -1146,7 +1203,7 @@ int linwarp( } @@ -16097,7 +17836,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c for (j = 0; j < naxis; j++) { ssqdis[j] /= *nsamp; sumdis[j] /= *nsamp; -@@ -1167,7 +1166,7 @@ cleanup: +@@ -1167,7 +1224,7 @@ cleanup: return status; } @@ -16106,7 +17845,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c int matinv(int n, const double mat[], double inv[]) -@@ -1177,7 +1176,7 @@ int matinv(int n, const double mat[], do +@@ -1177,7 +1234,7 @@ int matinv(int n, const double mat[], do double colmax, *lu, *rowmax, dtemp; @@ -16115,7 +17854,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c if ((mxl = calloc(n, sizeof(int))) == 0x0) { return LINERR_MEMORY; } -@@ -1200,9 +1199,9 @@ int matinv(int n, const double mat[], do +@@ -1200,9 +1257,9 @@ int matinv(int n, const double mat[], do } @@ -16127,7 +17866,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c mxl[i] = i; rowmax[i] = 0.0; -@@ -1214,7 +1213,7 @@ int matinv(int n, const double mat[], do +@@ -1214,7 +1271,7 @@ int matinv(int n, const double mat[], do lu[ij] = mat[ij]; } @@ -16136,7 +17875,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c if (rowmax[i] == 0.0) { free(mxl); free(lxm); -@@ -1225,9 +1224,9 @@ int matinv(int n, const double mat[], do +@@ -1225,9 +1282,9 @@ int matinv(int n, const double mat[], do } @@ -16148,7 +17887,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c colmax = fabs(lu[k*n+k]) / rowmax[k]; pivot = k; -@@ -1241,34 +1240,34 @@ int matinv(int n, const double mat[], do +@@ -1241,34 +1298,34 @@ int matinv(int n, const double mat[], do } if (pivot > k) { @@ -16190,7 +17929,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c for (j = k+1; j < n; j++) { lu[i*n+j] -= lu[ik]*lu[k*n+j]; } -@@ -1277,14 +1276,14 @@ int matinv(int n, const double mat[], do +@@ -1277,14 +1334,14 @@ int matinv(int n, const double mat[], do } @@ -16208,7 +17947,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c for (i = 0, ij = 0; i < n; i++) { for (j = 0; j < n; j++, ij++) { inv[ij] = 0.0; -@@ -1294,14 +1293,14 @@ int matinv(int n, const double mat[], do +@@ -1294,14 +1351,14 @@ int matinv(int n, const double mat[], do for (k = 0; k < n; k++) { inv[lxm[k]*n+k] = 1.0; @@ -16225,16 +17964,16 @@ Index: astropy-4.2/cextern/wcslib/C/lin.c for (i = n-1; i >= 0; i--) { for (j = i+1; j < n; j++) { inv[i*n+k] -= lu[i*n+j]*inv[j*n+k]; -Index: astropy-4.2/cextern/wcslib/C/lin.h +Index: astropy-4.2.1/cextern/wcslib/C/lin.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/lin.h -+++ astropy-4.2/cextern/wcslib/C/lin.h +--- astropy-4.2.1.orig/cextern/wcslib/C/lin.h ++++ astropy-4.2.1/cextern/wcslib/C/lin.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -16248,15 +17987,62 @@ Index: astropy-4.2/cextern/wcslib/C/lin.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: lin.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: lin.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: lin.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * -@@ -619,44 +616,44 @@ extern "C" { +@@ -44,8 +41,8 @@ + * like a C++ class but with no encapsulation. + * + * Six routines, linini(), lininit(), lindis(), lindist() lincpy(), and +-* linfree() are provided to manage the linprm struct, and another, linprt(), +-* prints its contents. ++* linfree() are provided to manage the linprm struct, linsize() computes its ++* total size including allocated memory, and linprt() prints its contents. + * + * linperr() prints the error message(s) (if any) stored in a linprm struct, + * and the disprm structs that it may contain. +@@ -225,6 +222,35 @@ + * 1: Null linprm pointer passed. + * + * ++* linsize() - Compute the size of a linprm struct ++* ----------------------------------------------- ++* linsize() computes the full size of a linprm struct, including allocated ++* memory. ++* ++* Given: ++* lin const struct linprm* ++* Linear transformation parameters. ++* ++* If NULL, the base size of the struct and the allocated ++* size are both set to zero. ++* ++* Returned: ++* sizes int[2] The first element is the base size of the struct as ++* returned by sizeof(struct linprm). The second element ++* is the total allocated size, in bytes, assuming that ++* the allocation was done by linini(). This figure ++* includes memory allocated for members of constituent ++* structs, such as linprm::dispre. ++* ++* It is not an error for the struct not to have been set ++* up via linset(), which normally results in additional ++* memory allocation. ++* ++* Function return value: ++* int Status return value: ++* 0: Success. ++* ++* + * linprt() - Print routine for the linprm struct + * ---------------------------------------------- + * linprt() prints the contents of a linprm struct using wcsprintf(). Mainly +@@ -619,44 +645,44 @@ extern "C" { extern const char *lin_errmsg[]; enum lin_errmsg_enum { @@ -16333,7 +18119,7 @@ Index: astropy-4.2/cextern/wcslib/C/lin.h double *tmpcrd; int m_flag, m_naxis; -@@ -664,7 +661,7 @@ struct linprm { +@@ -664,7 +690,7 @@ struct linprm { struct disprm *m_dispre, *m_disseq; }; @@ -16342,7 +18128,16 @@ Index: astropy-4.2/cextern/wcslib/C/lin.h #define LINLEN (sizeof(struct linprm)/sizeof(int)) -@@ -701,7 +698,7 @@ int linwarp(struct linprm *lin, const do +@@ -680,6 +706,8 @@ int lincpy(int alloc, const struct linpr + + int linfree(struct linprm *lin); + ++int linsize(const struct linprm *lin, int sizes[2]); ++ + int linprt(const struct linprm *lin); + + int linperr(const struct linprm *lin, const char *prefix); +@@ -701,7 +729,7 @@ int linwarp(struct linprm *lin, const do int matinv(int n, const double mat[], double inv[]); @@ -16351,22 +18146,22 @@ Index: astropy-4.2/cextern/wcslib/C/lin.h #define linini_errmsg lin_errmsg #define lincpy_errmsg lin_errmsg #define linfree_errmsg lin_errmsg -@@ -714,4 +711,4 @@ int matinv(int n, const double mat[], do +@@ -714,4 +742,4 @@ int matinv(int n, const double mat[], do } #endif -#endif /* WCSLIB_LIN */ +#endif // WCSLIB_LIN -Index: astropy-4.2/cextern/wcslib/C/log.c +Index: astropy-4.2.1/cextern/wcslib/C/log.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/log.c -+++ astropy-4.2/cextern/wcslib/C/log.c +--- astropy-4.2.1.orig/cextern/wcslib/C/log.c ++++ astropy-4.2.1/cextern/wcslib/C/log.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -16380,7 +18175,7 @@ Index: astropy-4.2/cextern/wcslib/C/log.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: log.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: log.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: log.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -16410,16 +18205,16 @@ Index: astropy-4.2/cextern/wcslib/C/log.c int logs2x( double crval, -Index: astropy-4.2/cextern/wcslib/C/log.h +Index: astropy-4.2.1/cextern/wcslib/C/log.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/log.h -+++ astropy-4.2/cextern/wcslib/C/log.h +--- astropy-4.2.1.orig/cextern/wcslib/C/log.h ++++ astropy-4.2.1/cextern/wcslib/C/log.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -16433,11 +18228,11 @@ Index: astropy-4.2/cextern/wcslib/C/log.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: log.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: log.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: log.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * @@ -16468,16 +18263,16 @@ Index: astropy-4.2/cextern/wcslib/C/log.h -#endif /* WCSLIB_LOG */ +#endif // WCSLIB_LOG -Index: astropy-4.2/cextern/wcslib/C/prj.c +Index: astropy-4.2.1/cextern/wcslib/C/prj.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/prj.c -+++ astropy-4.2/cextern/wcslib/C/prj.c +--- astropy-4.2.1.orig/cextern/wcslib/C/prj.c ++++ astropy-4.2.1/cextern/wcslib/C/prj.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -16491,7 +18286,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: prj.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: prj.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: prj.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -16531,7 +18326,16 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c #define PRJERR_BAD_PARAM_SET(function) \ wcserr_set(&(prj->err), PRJERR_BAD_PARAM, function, __FILE__, __LINE__, \ "Invalid parameters for %s projection", prj->name); -@@ -184,7 +181,7 @@ int prjini(struct prjprm *prj) +@@ -124,6 +121,8 @@ 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. ++* + * prjprt prints the contents of a prjprm struct. + * + * prjbchk performs bounds checking on the native coordinates returned by the +@@ -184,7 +183,7 @@ int prjini(struct prjprm *prj) return 0; } @@ -16540,16 +18344,41 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int prjfree(struct prjprm *prj) -@@ -196,7 +193,7 @@ int prjfree(struct prjprm *prj) +@@ -196,7 +195,32 @@ int prjfree(struct prjprm *prj) return 0; } -/*--------------------------------------------------------------------------*/ ++//---------------------------------------------------------------------------- ++ ++int prjsize(const struct prjprm *prj, int sizes[2]) ++ ++{ ++ if (prj == 0x0) { ++ sizes[0] = sizes[1] = 0; ++ return PRJERR_SUCCESS; ++ } ++ ++ // Base size, in bytes. ++ sizes[0] = sizeof(struct prjprm); ++ ++ // Total size of allocated memory, in bytes. ++ sizes[1] = 0; ++ ++ int exsizes[2]; ++ ++ // prjprm::err. ++ wcserr_size(prj->err, exsizes); ++ sizes[1] += exsizes[0] + exsizes[1]; ++ ++ return PRJERR_SUCCESS; ++} ++ +//---------------------------------------------------------------------------- int prjprt(const struct prjprm *prj) -@@ -284,7 +281,7 @@ int prjprt(const struct prjprm *prj) +@@ -284,7 +308,7 @@ int prjprt(const struct prjprm *prj) return 0; } @@ -16558,7 +18387,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int prjperr(const struct prjprm *prj, const char *prefix) -@@ -298,7 +295,7 @@ int prjperr(const struct prjprm *prj, co +@@ -298,7 +322,7 @@ int prjperr(const struct prjprm *prj, co return 0; } @@ -16567,7 +18396,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int prjbchk( double tol, -@@ -319,7 +316,7 @@ int prjbchk( +@@ -319,7 +343,7 @@ int prjbchk( statp = stat; for (itheta = 0; itheta < ntheta; itheta++) { for (iphi = 0; iphi < nphi; iphi++, phip += spt, thetap += spt, statp++) { @@ -16576,7 +18405,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (*statp == 0) { if (*phip < -180.0) { if (*phip < -180.0-tol) { -@@ -359,7 +356,7 @@ int prjbchk( +@@ -359,7 +383,7 @@ int prjbchk( return status; } @@ -16585,7 +18414,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int prjset(struct prjprm *prj) -@@ -372,7 +369,7 @@ int prjset(struct prjprm *prj) +@@ -372,7 +396,7 @@ int prjset(struct prjprm *prj) if (prj == 0x0) return PRJERR_NULL_POINTER; err = &(prj->err); @@ -16594,7 +18423,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c prj->code[3] = '\0'; if (strcmp(prj->code, "AZP") == 0) { status = azpset(prj); -@@ -431,7 +428,7 @@ int prjset(struct prjprm *prj) +@@ -431,7 +455,7 @@ int prjset(struct prjprm *prj) } else if (strcmp(prj->code, "XPH") == 0) { status = xphset(prj); } else { @@ -16603,7 +18432,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c status = wcserr_set(WCSERR_SET(PRJERR_BAD_PARAM), "Unrecognized projection code '%s'", prj->code); } -@@ -439,7 +436,7 @@ int prjset(struct prjprm *prj) +@@ -439,7 +463,7 @@ int prjset(struct prjprm *prj) return status; } @@ -16612,7 +18441,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int prjx2s( struct prjprm *prj, -@@ -456,7 +453,7 @@ int prjx2s( +@@ -456,7 +480,7 @@ int prjx2s( { int status; @@ -16621,7 +18450,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag == 0) { if ((status = prjset(prj))) return status; -@@ -465,7 +462,7 @@ int prjx2s( +@@ -465,7 +489,7 @@ int prjx2s( return prj->prjx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat); } @@ -16630,7 +18459,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int prjs2x( struct prjprm *prj, -@@ -482,7 +479,7 @@ int prjs2x( +@@ -482,7 +506,7 @@ int prjs2x( { int status; @@ -16639,7 +18468,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag == 0) { if ((status = prjset(prj))) return status; -@@ -511,7 +508,7 @@ int prjoff( +@@ -511,7 +535,7 @@ int prjoff( prj->y0 = 0.0; if (undefined(prj->phi0) || undefined(prj->theta0)) { @@ -16648,7 +18477,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c prj->phi0 = phi0; prj->theta0 = theta0; -@@ -607,7 +604,7 @@ int azpset(struct prjprm *prj) +@@ -607,7 +631,7 @@ int azpset(struct prjprm *prj) return prjoff(prj, 0.0, 90.0); } @@ -16657,7 +18486,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int azpx2s( struct prjprm *prj, -@@ -630,7 +627,7 @@ int azpx2s( +@@ -630,7 +654,7 @@ int azpx2s( register double *phip, *thetap; @@ -16666,7 +18495,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != AZP) { if ((status = azpset(prj))) return status; -@@ -648,7 +645,7 @@ int azpx2s( +@@ -648,7 +672,7 @@ int azpx2s( status = 0; @@ -16675,7 +18504,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -663,7 +660,7 @@ int azpx2s( +@@ -663,7 +687,7 @@ int azpx2s( } @@ -16684,7 +18513,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -718,7 +715,7 @@ int azpx2s( +@@ -718,7 +742,7 @@ int azpx2s( } @@ -16693,7 +18522,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("azpx2s"); } -@@ -726,7 +723,7 @@ int azpx2s( +@@ -726,7 +750,7 @@ int azpx2s( return status; } @@ -16702,7 +18531,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int azps2x( struct prjprm *prj, -@@ -748,7 +745,7 @@ int azps2x( +@@ -748,7 +772,7 @@ int azps2x( register double *xp, *yp; @@ -16711,7 +18540,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != AZP) { if ((status = azpset(prj))) return status; -@@ -766,7 +763,7 @@ int azps2x( +@@ -766,7 +790,7 @@ int azps2x( status = 0; @@ -16720,7 +18549,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -784,7 +781,7 @@ int azps2x( +@@ -784,7 +808,7 @@ int azps2x( } @@ -16729,7 +18558,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -805,16 +802,16 @@ int azps2x( +@@ -805,16 +829,16 @@ int azps2x( } else { r = prj->w[0]*costhe/t; @@ -16749,7 +18578,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c t = prj->pv[1] / sqrt(1.0 + s*s); if (fabs(t) <= 1.0) { -@@ -926,7 +923,7 @@ int szpset(struct prjprm *prj) +@@ -926,7 +950,7 @@ int szpset(struct prjprm *prj) return prjoff(prj, 0.0, 90.0); } @@ -16758,7 +18587,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int szpx2s( struct prjprm *prj, -@@ -949,7 +946,7 @@ int szpx2s( +@@ -949,7 +973,7 @@ int szpx2s( register double *phip, *thetap; @@ -16767,7 +18596,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != SZP) { if ((status = szpset(prj))) return status; -@@ -967,7 +964,7 @@ int szpx2s( +@@ -967,7 +991,7 @@ int szpx2s( status = 0; @@ -16776,7 +18605,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -982,7 +979,7 @@ int szpx2s( +@@ -982,7 +1006,7 @@ int szpx2s( } @@ -16785,7 +18614,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -999,7 +996,7 @@ int szpx2s( +@@ -999,7 +1023,7 @@ int szpx2s( xy = xr*x1 + yr*y1; if (r2 < 1.0e-10) { @@ -16794,7 +18623,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c z = r2/2.0; *thetap = 90.0 - R2D*sqrt(r2/(1.0 + xy)); -@@ -1010,7 +1007,7 @@ int szpx2s( +@@ -1010,7 +1034,7 @@ int szpx2s( c = r2 - xy - xy + t - 1.0; d = b*b - a*c; @@ -16803,7 +18632,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (d < 0.0) { *phip = 0.0; *thetap = 0.0; -@@ -1020,7 +1017,7 @@ int szpx2s( +@@ -1020,7 +1044,7 @@ int szpx2s( } d = sqrt(d); @@ -16812,7 +18641,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c sinth1 = (-b + d)/a; sinth2 = (-b - d)/a; sinthe = (sinth1 > sinth2) ? sinth1 : sinth2; -@@ -1057,7 +1054,7 @@ int szpx2s( +@@ -1057,7 +1081,7 @@ int szpx2s( } @@ -16821,7 +18650,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("szpx2s"); } -@@ -1065,7 +1062,7 @@ int szpx2s( +@@ -1065,7 +1089,7 @@ int szpx2s( return status; } @@ -16830,7 +18659,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int szps2x( struct prjprm *prj, -@@ -1087,7 +1084,7 @@ int szps2x( +@@ -1087,7 +1111,7 @@ int szps2x( register double *xp, *yp; @@ -16839,7 +18668,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != SZP) { if ((status = szpset(prj))) return status; -@@ -1105,7 +1102,7 @@ int szps2x( +@@ -1105,7 +1129,7 @@ int szps2x( status = 0; @@ -16848,7 +18677,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -1123,7 +1120,7 @@ int szps2x( +@@ -1123,7 +1147,7 @@ int szps2x( } @@ -16857,7 +18686,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -1147,16 +1144,16 @@ int szps2x( +@@ -1147,16 +1171,16 @@ int szps2x( v = prj->w[5]*s/t + prj->y0; for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { @@ -16877,7 +18706,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c s = prj->w[1]*(*xp) - prj->w[2]*(*yp); t = 1.0/sqrt(prj->w[7] + s*s); -@@ -1230,7 +1227,7 @@ int tanset(struct prjprm *prj) +@@ -1230,7 +1254,7 @@ int tanset(struct prjprm *prj) return prjoff(prj, 0.0, 90.0); } @@ -16886,7 +18715,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int tanx2s( struct prjprm *prj, -@@ -1252,7 +1249,7 @@ int tanx2s( +@@ -1252,7 +1276,7 @@ int tanx2s( register double *phip, *thetap; @@ -16895,7 +18724,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != TAN) { if ((status = tanset(prj))) return status; -@@ -1270,7 +1267,7 @@ int tanx2s( +@@ -1270,7 +1294,7 @@ int tanx2s( status = 0; @@ -16904,7 +18733,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -1285,7 +1282,7 @@ int tanx2s( +@@ -1285,7 +1309,7 @@ int tanx2s( } @@ -16913,7 +18742,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -1310,7 +1307,7 @@ int tanx2s( +@@ -1310,7 +1334,7 @@ int tanx2s( } @@ -16922,7 +18751,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("tanx2s"); } -@@ -1318,7 +1315,7 @@ int tanx2s( +@@ -1318,7 +1342,7 @@ int tanx2s( return status; } @@ -16931,7 +18760,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int tans2x( struct prjprm *prj, -@@ -1340,7 +1337,7 @@ int tans2x( +@@ -1340,7 +1364,7 @@ int tans2x( register double *xp, *yp; @@ -16940,7 +18769,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != TAN) { if ((status = tanset(prj))) return status; -@@ -1358,7 +1355,7 @@ int tans2x( +@@ -1358,7 +1382,7 @@ int tans2x( status = 0; @@ -16949,7 +18778,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -1376,7 +1373,7 @@ int tans2x( +@@ -1376,7 +1400,7 @@ int tans2x( } @@ -16958,7 +18787,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -1394,7 +1391,7 @@ int tans2x( +@@ -1394,7 +1418,7 @@ int tans2x( } else { r = prj->r0*cosd(*thetap)/s; @@ -16967,7 +18796,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c istat = 0; if (prj->bounds&1) { if (s < 0.0) { -@@ -1465,7 +1462,7 @@ int stgset(struct prjprm *prj) +@@ -1465,7 +1489,7 @@ int stgset(struct prjprm *prj) return prjoff(prj, 0.0, 90.0); } @@ -16976,7 +18805,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int stgx2s( struct prjprm *prj, -@@ -1487,7 +1484,7 @@ int stgx2s( +@@ -1487,7 +1511,7 @@ int stgx2s( register double *phip, *thetap; @@ -16985,7 +18814,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != STG) { if ((status = stgset(prj))) return status; -@@ -1503,7 +1500,7 @@ int stgx2s( +@@ -1503,7 +1527,7 @@ int stgx2s( } @@ -16994,7 +18823,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -1518,7 +1515,7 @@ int stgx2s( +@@ -1518,7 +1542,7 @@ int stgx2s( } @@ -17003,7 +18832,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -1545,7 +1542,7 @@ int stgx2s( +@@ -1545,7 +1569,7 @@ int stgx2s( return 0; } @@ -17012,7 +18841,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int stgs2x( struct prjprm *prj, -@@ -1567,7 +1564,7 @@ int stgs2x( +@@ -1567,7 +1591,7 @@ int stgs2x( register double *xp, *yp; @@ -17021,7 +18850,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != STG) { if ((status = stgset(prj))) return status; -@@ -1585,7 +1582,7 @@ int stgs2x( +@@ -1585,7 +1609,7 @@ int stgs2x( status = 0; @@ -17030,7 +18859,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -1603,7 +1600,7 @@ int stgs2x( +@@ -1603,7 +1627,7 @@ int stgs2x( } @@ -17039,7 +18868,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -1688,7 +1685,7 @@ int sinset(struct prjprm *prj) +@@ -1688,7 +1712,7 @@ int sinset(struct prjprm *prj) return prjoff(prj, 0.0, 90.0); } @@ -17048,7 +18877,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int sinx2s( struct prjprm *prj, -@@ -1712,7 +1709,7 @@ int sinx2s( +@@ -1712,7 +1736,7 @@ int sinx2s( register double *phip, *thetap; @@ -17057,7 +18886,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != SIN) { if ((status = sinset(prj))) return status; -@@ -1733,7 +1730,7 @@ int sinx2s( +@@ -1733,7 +1757,7 @@ int sinx2s( status = 0; @@ -17066,7 +18895,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -1748,7 +1745,7 @@ int sinx2s( +@@ -1748,7 +1772,7 @@ int sinx2s( } @@ -17075,7 +18904,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -1758,12 +1755,12 @@ int sinx2s( +@@ -1758,12 +1782,12 @@ int sinx2s( y02 = y0*y0; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { @@ -17090,7 +18919,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (r2 != 0.0) { *phip = atan2d(x0, -y0); } else { -@@ -1781,11 +1778,11 @@ int sinx2s( +@@ -1781,11 +1805,11 @@ int sinx2s( } } else { @@ -17104,7 +18933,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c z = r2/2.0; *thetap = 90.0 - R2D*sqrt(r2/(1.0 + xy)); -@@ -1795,7 +1792,7 @@ int sinx2s( +@@ -1795,7 +1819,7 @@ int sinx2s( c = r2 - xy - xy + prj->w[3]; d = b*b - a*c; @@ -17113,7 +18942,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (d < 0.0) { *phip = 0.0; *thetap = 0.0; -@@ -1805,7 +1802,7 @@ int sinx2s( +@@ -1805,7 +1829,7 @@ int sinx2s( } d = sqrt(d); @@ -17122,7 +18951,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c sinth1 = (-b + d)/a; sinth2 = (-b - d)/a; sinthe = (sinth1 > sinth2) ? sinth1 : sinth2; -@@ -1849,7 +1846,7 @@ int sinx2s( +@@ -1849,7 +1873,7 @@ int sinx2s( } @@ -17131,7 +18960,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("sinx2s"); } -@@ -1857,7 +1854,7 @@ int sinx2s( +@@ -1857,7 +1881,7 @@ int sinx2s( return status; } @@ -17140,7 +18969,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int sins2x( struct prjprm *prj, -@@ -1879,7 +1876,7 @@ int sins2x( +@@ -1879,7 +1903,7 @@ int sins2x( register double *xp, *yp; @@ -17149,7 +18978,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != SIN) { if ((status = sinset(prj))) return status; -@@ -1897,7 +1894,7 @@ int sins2x( +@@ -1897,7 +1921,7 @@ int sins2x( status = 0; @@ -17158,7 +18987,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -1915,7 +1912,7 @@ int sins2x( +@@ -1915,7 +1939,7 @@ int sins2x( } @@ -17167,7 +18996,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -1936,7 +1933,7 @@ int sins2x( +@@ -1936,7 +1960,7 @@ int sins2x( r = prj->r0*costhe; if (prj->w[1] == 0.0) { @@ -17176,7 +19005,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c istat = 0; if (prj->bounds&1) { if (*thetap < 0.0) { -@@ -1952,7 +1949,7 @@ int sins2x( +@@ -1952,7 +1976,7 @@ int sins2x( } } else { @@ -17185,7 +19014,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c z *= prj->r0; z1 = prj->pv[1]*z - prj->x0; z2 = prj->pv[2]*z - prj->y0; -@@ -2028,7 +2025,7 @@ int arcset(struct prjprm *prj) +@@ -2028,7 +2052,7 @@ int arcset(struct prjprm *prj) return prjoff(prj, 0.0, 90.0); } @@ -17194,7 +19023,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int arcx2s( struct prjprm *prj, -@@ -2050,7 +2047,7 @@ int arcx2s( +@@ -2050,7 +2074,7 @@ int arcx2s( register double *phip, *thetap; @@ -17203,7 +19032,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != ARC) { if ((status = arcset(prj))) return status; -@@ -2068,7 +2065,7 @@ int arcx2s( +@@ -2068,7 +2092,7 @@ int arcx2s( status = 0; @@ -17212,7 +19041,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -2083,7 +2080,7 @@ int arcx2s( +@@ -2083,7 +2107,7 @@ int arcx2s( } @@ -17221,7 +19050,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -2109,7 +2106,7 @@ int arcx2s( +@@ -2109,7 +2133,7 @@ int arcx2s( } @@ -17230,7 +19059,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("arcx2s"); } -@@ -2117,7 +2114,7 @@ int arcx2s( +@@ -2117,7 +2141,7 @@ int arcx2s( return status; } @@ -17239,7 +19068,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int arcs2x( struct prjprm *prj, -@@ -2139,7 +2136,7 @@ int arcs2x( +@@ -2139,7 +2163,7 @@ int arcs2x( register double *xp, *yp; @@ -17248,7 +19077,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != ARC) { if ((status = arcset(prj))) return status; -@@ -2155,7 +2152,7 @@ int arcs2x( +@@ -2155,7 +2179,7 @@ int arcs2x( } @@ -17257,7 +19086,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -2173,7 +2170,7 @@ int arcs2x( +@@ -2173,7 +2197,7 @@ int arcs2x( } @@ -17266,7 +19095,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -2240,7 +2237,7 @@ int zpnset(struct prjprm *prj) +@@ -2240,7 +2264,7 @@ int zpnset(struct prjprm *prj) prj->global = 0; prj->divergent = 0; @@ -17275,7 +19104,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c for (k = PVN-1; k >= 0 && prj->pv[k] == 0.0; k--); if (k < 0) { return PRJERR_BAD_PARAM_SET("zpnset"); -@@ -2249,18 +2246,18 @@ int zpnset(struct prjprm *prj) +@@ -2249,18 +2273,18 @@ int zpnset(struct prjprm *prj) prj->n = k; if (k < 2) { @@ -17297,7 +19126,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c for (j = 0; j < 180; j++) { zd2 = j*D2R; d2 = 0.0; -@@ -2274,11 +2271,11 @@ int zpnset(struct prjprm *prj) +@@ -2274,11 +2298,11 @@ int zpnset(struct prjprm *prj) } if (j == 180) { @@ -17311,7 +19140,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c for (j = 1; j <= 10; j++) { zd = zd1 - d1*(zd2-zd1)/(d2-d1); -@@ -2313,7 +2310,7 @@ int zpnset(struct prjprm *prj) +@@ -2313,7 +2337,7 @@ int zpnset(struct prjprm *prj) return prjoff(prj, 0.0, 90.0); } @@ -17320,7 +19149,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int zpnx2s( struct prjprm *prj, -@@ -2336,7 +2333,7 @@ int zpnx2s( +@@ -2336,7 +2360,7 @@ int zpnx2s( register double *phip, *thetap; @@ -17329,7 +19158,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != ZPN) { if ((status = zpnset(prj))) return status; -@@ -2356,7 +2353,7 @@ int zpnx2s( +@@ -2356,7 +2380,7 @@ int zpnx2s( status = 0; @@ -17338,7 +19167,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -2371,7 +2368,7 @@ int zpnx2s( +@@ -2371,7 +2395,7 @@ int zpnx2s( } @@ -17347,7 +19176,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -2391,15 +2388,15 @@ int zpnx2s( +@@ -2391,15 +2415,15 @@ int zpnx2s( } if (k < 1) { @@ -17366,7 +19195,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c a = prj->pv[2]; b = prj->pv[1]; c = prj->pv[0] - r; -@@ -2413,7 +2410,7 @@ int zpnx2s( +@@ -2413,7 +2437,7 @@ int zpnx2s( } d = sqrt(d); @@ -17375,7 +19204,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c zd1 = (-b + d)/(2.0*a); zd2 = (-b - d)/(2.0*a); zd = (zd1pv[0]; zd2 = prj->w[0]; -@@ -2459,7 +2456,7 @@ int zpnx2s( +@@ -2459,7 +2483,7 @@ int zpnx2s( } zd = zd2; } else { @@ -17393,7 +19222,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c for (j = 0; j < 100; j++) { lambda = (r2 - r)/(r2 - r1); if (lambda < 0.1) { -@@ -2496,7 +2493,7 @@ int zpnx2s( +@@ -2496,7 +2520,7 @@ int zpnx2s( } @@ -17402,7 +19231,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("zpnx2s"); } -@@ -2504,7 +2501,7 @@ int zpnx2s( +@@ -2504,7 +2528,7 @@ int zpnx2s( return status; } @@ -17411,7 +19240,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int zpns2x( struct prjprm *prj, -@@ -2526,7 +2523,7 @@ int zpns2x( +@@ -2526,7 +2550,7 @@ int zpns2x( register double *xp, *yp; @@ -17420,7 +19249,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != ZPN) { if ((status = zpnset(prj))) return status; -@@ -2544,7 +2541,7 @@ int zpns2x( +@@ -2544,7 +2568,7 @@ int zpns2x( status = 0; @@ -17429,7 +19258,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -2562,7 +2559,7 @@ int zpns2x( +@@ -2562,7 +2586,7 @@ int zpns2x( } @@ -17438,7 +19267,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -2576,7 +2573,7 @@ int zpns2x( +@@ -2576,7 +2600,7 @@ int zpns2x( } r *= prj->r0; @@ -17447,7 +19276,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c istat = 0; if (prj->bounds&1) { if (s > prj->w[0]) { -@@ -2646,7 +2643,7 @@ int zeaset(struct prjprm *prj) +@@ -2646,7 +2670,7 @@ int zeaset(struct prjprm *prj) return prjoff(prj, 0.0, 90.0); } @@ -17456,7 +19285,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int zeax2s( struct prjprm *prj, -@@ -2669,7 +2666,7 @@ int zeax2s( +@@ -2669,7 +2693,7 @@ int zeax2s( register double *phip, *thetap; @@ -17465,7 +19294,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != ZEA) { if ((status = zeaset(prj))) return status; -@@ -2687,7 +2684,7 @@ int zeax2s( +@@ -2687,7 +2711,7 @@ int zeax2s( status = 0; @@ -17474,7 +19303,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -2702,7 +2699,7 @@ int zeax2s( +@@ -2702,7 +2726,7 @@ int zeax2s( } @@ -17483,7 +19312,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -2740,7 +2737,7 @@ int zeax2s( +@@ -2740,7 +2764,7 @@ int zeax2s( } @@ -17492,7 +19321,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("zeax2s"); } -@@ -2748,7 +2745,7 @@ int zeax2s( +@@ -2748,7 +2772,7 @@ int zeax2s( return status; } @@ -17501,7 +19330,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int zeas2x( struct prjprm *prj, -@@ -2770,7 +2767,7 @@ int zeas2x( +@@ -2770,7 +2794,7 @@ int zeas2x( register double *xp, *yp; @@ -17510,7 +19339,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != ZEA) { if ((status = zeaset(prj))) return status; -@@ -2786,7 +2783,7 @@ int zeas2x( +@@ -2786,7 +2810,7 @@ int zeas2x( } @@ -17519,7 +19348,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -2804,7 +2801,7 @@ int zeas2x( +@@ -2804,7 +2828,7 @@ int zeas2x( } @@ -17528,7 +19357,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -2897,7 +2894,7 @@ int airset(struct prjprm *prj) +@@ -2897,7 +2921,7 @@ int airset(struct prjprm *prj) return prjoff(prj, 0.0, 90.0); } @@ -17537,7 +19366,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int airx2s( struct prjprm *prj, -@@ -2920,7 +2917,7 @@ int airx2s( +@@ -2920,7 +2944,7 @@ int airx2s( register double *phip, *thetap; @@ -17546,7 +19375,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != AIR) { if ((status = airset(prj))) return status; -@@ -2938,7 +2935,7 @@ int airx2s( +@@ -2938,7 +2962,7 @@ int airx2s( status = 0; @@ -17555,7 +19384,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -2953,7 +2950,7 @@ int airx2s( +@@ -2953,7 +2977,7 @@ int airx2s( } @@ -17564,7 +19393,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -2978,7 +2975,7 @@ int airx2s( +@@ -2978,7 +3002,7 @@ int airx2s( } else if (r < prj->w[5]) { xi = r*prj->w[6]; } else { @@ -17573,7 +19402,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c x1 = x2 = 1.0; r1 = r2 = 0.0; for (k = 0; k < 30; k++) { -@@ -2998,7 +2995,7 @@ int airx2s( +@@ -2998,7 +3022,7 @@ int airx2s( } for (k = 0; k < 100; k++) { @@ -17582,7 +19411,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c lambda = (r2-r)/(r2-r1); if (lambda < 0.1) { lambda = 0.1; -@@ -3036,7 +3033,7 @@ int airx2s( +@@ -3036,7 +3060,7 @@ int airx2s( } @@ -17591,7 +19420,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("airx2s"); } -@@ -3044,7 +3041,7 @@ int airx2s( +@@ -3044,7 +3068,7 @@ int airx2s( return status; } @@ -17600,7 +19429,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int airs2x( struct prjprm *prj, -@@ -3066,7 +3063,7 @@ int airs2x( +@@ -3066,7 +3090,7 @@ int airs2x( register double *xp, *yp; @@ -17609,7 +19438,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != AIR) { if ((status = airset(prj))) return status; -@@ -3084,7 +3081,7 @@ int airs2x( +@@ -3084,7 +3108,7 @@ int airs2x( status = 0; @@ -17618,7 +19447,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -3102,7 +3099,7 @@ int airs2x( +@@ -3102,7 +3126,7 @@ int airs2x( } @@ -17627,7 +19456,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -3222,7 +3219,7 @@ int cypset(struct prjprm *prj) +@@ -3222,7 +3246,7 @@ int cypset(struct prjprm *prj) return prjoff(prj, 0.0, 0.0); } @@ -17636,7 +19465,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int cypx2s( struct prjprm *prj, -@@ -3244,7 +3241,7 @@ int cypx2s( +@@ -3244,7 +3268,7 @@ int cypx2s( register double *phip, *thetap; @@ -17645,7 +19474,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CYP) { if ((status = cypset(prj))) return status; -@@ -3262,7 +3259,7 @@ int cypx2s( +@@ -3262,7 +3286,7 @@ int cypx2s( status = 0; @@ -17654,7 +19483,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -3277,7 +3274,7 @@ int cypx2s( +@@ -3277,7 +3301,7 @@ int cypx2s( } @@ -17663,7 +19492,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; thetap = theta; statp = stat; -@@ -3292,7 +3289,7 @@ int cypx2s( +@@ -3292,7 +3316,7 @@ int cypx2s( } @@ -17672,7 +19501,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("cypx2s"); } -@@ -3300,7 +3297,7 @@ int cypx2s( +@@ -3300,7 +3324,7 @@ int cypx2s( return status; } @@ -17681,7 +19510,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int cyps2x( struct prjprm *prj, -@@ -3322,7 +3319,7 @@ int cyps2x( +@@ -3322,7 +3346,7 @@ int cyps2x( register double *xp, *yp; @@ -17690,7 +19519,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CYP) { if ((status = cypset(prj))) return status; -@@ -3340,7 +3337,7 @@ int cyps2x( +@@ -3340,7 +3364,7 @@ int cyps2x( status = 0; @@ -17699,7 +19528,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -3355,7 +3352,7 @@ int cyps2x( +@@ -3355,7 +3379,7 @@ int cyps2x( } @@ -17708,7 +19537,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; yp = y; statp = stat; -@@ -3450,7 +3447,7 @@ int ceaset(struct prjprm *prj) +@@ -3450,7 +3474,7 @@ int ceaset(struct prjprm *prj) return prjoff(prj, 0.0, 0.0); } @@ -17717,7 +19546,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int ceax2s( struct prjprm *prj, -@@ -3473,7 +3470,7 @@ int ceax2s( +@@ -3473,7 +3497,7 @@ int ceax2s( register double *phip, *thetap; @@ -17726,7 +19555,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CEA) { if ((status = ceaset(prj))) return status; -@@ -3491,7 +3488,7 @@ int ceax2s( +@@ -3491,7 +3515,7 @@ int ceax2s( status = 0; @@ -17735,7 +19564,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -3506,7 +3503,7 @@ int ceax2s( +@@ -3506,7 +3530,7 @@ int ceax2s( } @@ -17744,7 +19573,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; thetap = theta; statp = stat; -@@ -3533,7 +3530,7 @@ int ceax2s( +@@ -3533,7 +3557,7 @@ int ceax2s( } @@ -17753,7 +19582,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("ceax2s"); } -@@ -3541,7 +3538,7 @@ int ceax2s( +@@ -3541,7 +3565,7 @@ int ceax2s( return status; } @@ -17762,7 +19591,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int ceas2x( struct prjprm *prj, -@@ -3563,7 +3560,7 @@ int ceas2x( +@@ -3563,7 +3587,7 @@ int ceas2x( register double *xp, *yp; @@ -17771,7 +19600,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CEA) { if ((status = ceaset(prj))) return status; -@@ -3579,7 +3576,7 @@ int ceas2x( +@@ -3579,7 +3603,7 @@ int ceas2x( } @@ -17780,7 +19609,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -3594,7 +3591,7 @@ int ceas2x( +@@ -3594,7 +3618,7 @@ int ceas2x( } @@ -17789,7 +19618,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; yp = y; statp = stat; -@@ -3661,7 +3658,7 @@ int carset(struct prjprm *prj) +@@ -3661,7 +3685,7 @@ int carset(struct prjprm *prj) return prjoff(prj, 0.0, 0.0); } @@ -17798,7 +19627,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int carx2s( struct prjprm *prj, -@@ -3683,7 +3680,7 @@ int carx2s( +@@ -3683,7 +3707,7 @@ int carx2s( register double *phip, *thetap; @@ -17807,7 +19636,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CAR) { if ((status = carset(prj))) return status; -@@ -3701,7 +3698,7 @@ int carx2s( +@@ -3701,7 +3725,7 @@ int carx2s( status = 0; @@ -17816,7 +19645,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -3716,7 +3713,7 @@ int carx2s( +@@ -3716,7 +3740,7 @@ int carx2s( } @@ -17825,7 +19654,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; thetap = theta; statp = stat; -@@ -3730,7 +3727,7 @@ int carx2s( +@@ -3730,7 +3754,7 @@ int carx2s( } @@ -17834,7 +19663,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("carx2s"); } -@@ -3738,7 +3735,7 @@ int carx2s( +@@ -3738,7 +3762,7 @@ int carx2s( return status; } @@ -17843,7 +19672,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int cars2x( struct prjprm *prj, -@@ -3760,7 +3757,7 @@ int cars2x( +@@ -3760,7 +3784,7 @@ int cars2x( register double *xp, *yp; @@ -17852,7 +19681,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CAR) { if ((status = carset(prj))) return status; -@@ -3776,7 +3773,7 @@ int cars2x( +@@ -3776,7 +3800,7 @@ int cars2x( } @@ -17861,7 +19690,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -3791,7 +3788,7 @@ int cars2x( +@@ -3791,7 +3815,7 @@ int cars2x( } @@ -17870,7 +19699,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; yp = y; statp = stat; -@@ -3858,7 +3855,7 @@ int merset(struct prjprm *prj) +@@ -3858,7 +3882,7 @@ int merset(struct prjprm *prj) return prjoff(prj, 0.0, 0.0); } @@ -17879,7 +19708,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int merx2s( struct prjprm *prj, -@@ -3880,7 +3877,7 @@ int merx2s( +@@ -3880,7 +3904,7 @@ int merx2s( register double *phip, *thetap; @@ -17888,7 +19717,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != MER) { if ((status = merset(prj))) return status; -@@ -3898,7 +3895,7 @@ int merx2s( +@@ -3898,7 +3922,7 @@ int merx2s( status = 0; @@ -17897,7 +19726,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -3913,7 +3910,7 @@ int merx2s( +@@ -3913,7 +3937,7 @@ int merx2s( } @@ -17906,7 +19735,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; thetap = theta; statp = stat; -@@ -3927,7 +3924,7 @@ int merx2s( +@@ -3927,7 +3951,7 @@ int merx2s( } @@ -17915,7 +19744,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("merx2s"); } -@@ -3935,7 +3932,7 @@ int merx2s( +@@ -3935,7 +3959,7 @@ int merx2s( return status; } @@ -17924,7 +19753,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int mers2x( struct prjprm *prj, -@@ -3957,7 +3954,7 @@ int mers2x( +@@ -3957,7 +3981,7 @@ int mers2x( register double *xp, *yp; @@ -17933,7 +19762,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != MER) { if ((status = merset(prj))) return status; -@@ -3975,7 +3972,7 @@ int mers2x( +@@ -3975,7 +3999,7 @@ int mers2x( status = 0; @@ -17942,7 +19771,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -3990,7 +3987,7 @@ int mers2x( +@@ -3990,7 +4014,7 @@ int mers2x( } @@ -17951,7 +19780,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; yp = y; statp = stat; -@@ -4065,7 +4062,7 @@ int sflset(struct prjprm *prj) +@@ -4065,7 +4089,7 @@ int sflset(struct prjprm *prj) return prjoff(prj, 0.0, 0.0); } @@ -17960,7 +19789,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int sflx2s( struct prjprm *prj, -@@ -4087,7 +4084,7 @@ int sflx2s( +@@ -4087,7 +4111,7 @@ int sflx2s( register double *phip, *thetap; @@ -17969,7 +19798,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != SFL) { if ((status = sflset(prj))) return status; -@@ -4105,7 +4102,7 @@ int sflx2s( +@@ -4105,7 +4129,7 @@ int sflx2s( status = 0; @@ -17978,7 +19807,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -4120,7 +4117,7 @@ int sflx2s( +@@ -4120,7 +4144,7 @@ int sflx2s( } @@ -17987,7 +19816,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -4147,7 +4144,7 @@ int sflx2s( +@@ -4147,7 +4171,7 @@ int sflx2s( } @@ -17996,7 +19825,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-12, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("sflx2s"); } -@@ -4155,7 +4152,7 @@ int sflx2s( +@@ -4155,7 +4179,7 @@ int sflx2s( return status; } @@ -18005,7 +19834,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int sfls2x( struct prjprm *prj, -@@ -4177,7 +4174,7 @@ int sfls2x( +@@ -4177,7 +4201,7 @@ int sfls2x( register double *xp, *yp; @@ -18014,7 +19843,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != SFL) { if ((status = sflset(prj))) return status; -@@ -4193,7 +4190,7 @@ int sfls2x( +@@ -4193,7 +4217,7 @@ int sfls2x( } @@ -18023,7 +19852,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -4208,7 +4205,7 @@ int sfls2x( +@@ -4208,7 +4232,7 @@ int sfls2x( } @@ -18032,7 +19861,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -4284,7 +4281,7 @@ int parset(struct prjprm *prj) +@@ -4284,7 +4308,7 @@ int parset(struct prjprm *prj) return prjoff(prj, 0.0, 0.0); } @@ -18041,7 +19870,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int parx2s( struct prjprm *prj, -@@ -4307,7 +4304,7 @@ int parx2s( +@@ -4307,7 +4331,7 @@ int parx2s( register double *phip, *thetap; @@ -18050,7 +19879,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != PAR) { if ((status = parset(prj))) return status; -@@ -4325,7 +4322,7 @@ int parx2s( +@@ -4325,7 +4349,7 @@ int parx2s( status = 0; @@ -18059,7 +19888,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -4345,7 +4342,7 @@ int parx2s( +@@ -4345,7 +4369,7 @@ int parx2s( } @@ -18068,7 +19897,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -4363,7 +4360,7 @@ int parx2s( +@@ -4363,7 +4387,7 @@ int parx2s( } else { s = 1.0 - 4.0*r*r; if (s == 0.0) { @@ -18077,7 +19906,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c istat = -1; } else { s = 1.0/s; -@@ -4390,7 +4387,7 @@ int parx2s( +@@ -4390,7 +4414,7 @@ int parx2s( } @@ -18086,7 +19915,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-12, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("parx2s"); } -@@ -4398,7 +4395,7 @@ int parx2s( +@@ -4398,7 +4422,7 @@ int parx2s( return status; } @@ -18095,7 +19924,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int pars2x( struct prjprm *prj, -@@ -4420,7 +4417,7 @@ int pars2x( +@@ -4420,7 +4444,7 @@ int pars2x( register double *xp, *yp; @@ -18104,7 +19933,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != PAR) { if ((status = parset(prj))) return status; -@@ -4436,7 +4433,7 @@ int pars2x( +@@ -4436,7 +4460,7 @@ int pars2x( } @@ -18113,7 +19942,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -4451,7 +4448,7 @@ int pars2x( +@@ -4451,7 +4475,7 @@ int pars2x( } @@ -18122,7 +19951,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -4523,7 +4520,7 @@ int molset(struct prjprm *prj) +@@ -4523,7 +4547,7 @@ int molset(struct prjprm *prj) return prjoff(prj, 0.0, 0.0); } @@ -18131,7 +19960,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int molx2s( struct prjprm *prj, -@@ -4546,7 +4543,7 @@ int molx2s( +@@ -4546,7 +4570,7 @@ int molx2s( register double *phip, *thetap; @@ -18140,7 +19969,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != MOL) { if ((status = molset(prj))) return status; -@@ -4564,7 +4561,7 @@ int molx2s( +@@ -4564,7 +4588,7 @@ int molx2s( status = 0; @@ -18149,7 +19978,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -4584,7 +4581,7 @@ int molx2s( +@@ -4584,7 +4608,7 @@ int molx2s( } @@ -18158,7 +19987,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -4600,7 +4597,7 @@ int molx2s( +@@ -4600,7 +4624,7 @@ int molx2s( istat = 1; if (!status) status = PRJERR_BAD_PIX_SET("molx2s"); } else { @@ -18167,7 +19996,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c istat = -1; } -@@ -4655,7 +4652,7 @@ int molx2s( +@@ -4655,7 +4679,7 @@ int molx2s( } @@ -18176,7 +20005,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-11, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("molx2s"); } -@@ -4663,7 +4660,7 @@ int molx2s( +@@ -4663,7 +4687,7 @@ int molx2s( return status; } @@ -18185,7 +20014,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int mols2x( struct prjprm *prj, -@@ -4686,7 +4683,7 @@ int mols2x( +@@ -4686,7 +4710,7 @@ int mols2x( register double *xp, *yp; @@ -18194,7 +20023,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != MOL) { if ((status = molset(prj))) return status; -@@ -4702,7 +4699,7 @@ int mols2x( +@@ -4702,7 +4726,7 @@ int mols2x( } @@ -18203,7 +20032,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -4717,7 +4714,7 @@ int mols2x( +@@ -4717,7 +4741,7 @@ int mols2x( } @@ -18212,7 +20041,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -4815,7 +4812,7 @@ int aitset(struct prjprm *prj) +@@ -4815,7 +4839,7 @@ int aitset(struct prjprm *prj) return prjoff(prj, 0.0, 0.0); } @@ -18221,7 +20050,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int aitx2s( struct prjprm *prj, -@@ -4838,7 +4835,7 @@ int aitx2s( +@@ -4838,7 +4862,7 @@ int aitx2s( register double *phip, *thetap; @@ -18230,7 +20059,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != AIT) { if ((status = aitset(prj))) return status; -@@ -4856,7 +4853,7 @@ int aitx2s( +@@ -4856,7 +4880,7 @@ int aitx2s( status = 0; @@ -18239,7 +20068,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -4876,7 +4873,7 @@ int aitx2s( +@@ -4876,7 +4900,7 @@ int aitx2s( } @@ -18248,7 +20077,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -4925,7 +4922,7 @@ int aitx2s( +@@ -4925,7 +4949,7 @@ int aitx2s( } @@ -18257,7 +20086,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("aitx2s"); } -@@ -4933,7 +4930,7 @@ int aitx2s( +@@ -4933,7 +4957,7 @@ int aitx2s( return status; } @@ -18266,7 +20095,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int aits2x( struct prjprm *prj, -@@ -4955,7 +4952,7 @@ int aits2x( +@@ -4955,7 +4979,7 @@ int aits2x( register double *xp, *yp; @@ -18275,7 +20104,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != AIT) { if ((status = aitset(prj))) return status; -@@ -4971,7 +4968,7 @@ int aits2x( +@@ -4971,7 +4995,7 @@ int aits2x( } @@ -18284,7 +20113,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -4990,7 +4987,7 @@ int aits2x( +@@ -4990,7 +5014,7 @@ int aits2x( } @@ -18293,7 +20122,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -5083,7 +5080,7 @@ int copset(struct prjprm *prj) +@@ -5083,7 +5107,7 @@ int copset(struct prjprm *prj) return prjoff(prj, 0.0, prj->pv[1]); } @@ -18302,7 +20131,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int copx2s( struct prjprm *prj, -@@ -5104,7 +5101,7 @@ int copx2s( +@@ -5104,7 +5128,7 @@ int copx2s( register const double *xp, *yp; register double *phip, *thetap; @@ -18311,7 +20140,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COP) { if ((status = copset(prj))) return status; -@@ -5122,7 +5119,7 @@ int copx2s( +@@ -5122,7 +5146,7 @@ int copx2s( status = 0; @@ -18320,7 +20149,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -5137,7 +5134,7 @@ int copx2s( +@@ -5137,7 +5161,7 @@ int copx2s( } @@ -18329,7 +20158,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -5165,7 +5162,7 @@ int copx2s( +@@ -5165,7 +5189,7 @@ int copx2s( } @@ -18338,7 +20167,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("copx2s"); } -@@ -5173,7 +5170,7 @@ int copx2s( +@@ -5173,7 +5197,7 @@ int copx2s( return status; } @@ -18347,7 +20176,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int cops2x( struct prjprm *prj, -@@ -5194,7 +5191,7 @@ int cops2x( +@@ -5194,7 +5218,7 @@ int cops2x( register const double *phip, *thetap; register double *xp, *yp; @@ -18356,7 +20185,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COP) { if ((status = copset(prj))) return status; -@@ -5212,7 +5209,7 @@ int cops2x( +@@ -5212,7 +5236,7 @@ int cops2x( status = 0; @@ -18365,7 +20194,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -5231,7 +5228,7 @@ int cops2x( +@@ -5231,7 +5255,7 @@ int cops2x( } @@ -18374,7 +20203,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -5243,16 +5240,16 @@ int cops2x( +@@ -5243,16 +5267,16 @@ int cops2x( istat = 0; if (s == 0.0) { @@ -18394,7 +20223,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&1) { if ((*thetap < 0.0) != (prj->pv[1] < 0.0)) { istat = 1; -@@ -5263,7 +5260,7 @@ int cops2x( +@@ -5263,7 +5287,7 @@ int cops2x( } else { r = prj->w[2] - prj->w[3]*sind(t)/s; @@ -18403,7 +20232,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&1) { if (r*prj->w[0] < 0.0) { istat = 1; -@@ -5363,7 +5360,7 @@ int coeset(struct prjprm *prj) +@@ -5363,7 +5387,7 @@ int coeset(struct prjprm *prj) return prjoff(prj, 0.0, prj->pv[1]); } @@ -18412,7 +20241,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int coex2s( struct prjprm *prj, -@@ -5385,7 +5382,7 @@ int coex2s( +@@ -5385,7 +5409,7 @@ int coex2s( register const double *xp, *yp; register double *phip, *thetap; @@ -18421,7 +20250,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COE) { if ((status = coeset(prj))) return status; -@@ -5403,7 +5400,7 @@ int coex2s( +@@ -5403,7 +5427,7 @@ int coex2s( status = 0; @@ -18430,7 +20259,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -5418,7 +5415,7 @@ int coex2s( +@@ -5418,7 +5442,7 @@ int coex2s( } @@ -18439,7 +20268,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -5466,7 +5463,7 @@ int coex2s( +@@ -5466,7 +5490,7 @@ int coex2s( } @@ -18448,7 +20277,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("coex2s"); } -@@ -5474,7 +5471,7 @@ int coex2s( +@@ -5474,7 +5498,7 @@ int coex2s( return status; } @@ -18457,7 +20286,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int coes2x( struct prjprm *prj, -@@ -5495,7 +5492,7 @@ int coes2x( +@@ -5495,7 +5519,7 @@ int coes2x( register const double *phip, *thetap; register double *xp, *yp; @@ -18466,7 +20295,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COE) { if ((status = coeset(prj))) return status; -@@ -5511,7 +5508,7 @@ int coes2x( +@@ -5511,7 +5535,7 @@ int coes2x( } @@ -18475,7 +20304,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -5530,7 +5527,7 @@ int coes2x( +@@ -5530,7 +5554,7 @@ int coes2x( } @@ -18484,7 +20313,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -5622,7 +5619,7 @@ int codset(struct prjprm *prj) +@@ -5622,7 +5646,7 @@ int codset(struct prjprm *prj) return prjoff(prj, 0.0, prj->pv[1]); } @@ -18493,7 +20322,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int codx2s( struct prjprm *prj, -@@ -5643,7 +5640,7 @@ int codx2s( +@@ -5643,7 +5667,7 @@ int codx2s( register const double *xp, *yp; register double *phip, *thetap; @@ -18502,7 +20331,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COD) { if ((status = codset(prj))) return status; -@@ -5661,7 +5658,7 @@ int codx2s( +@@ -5661,7 +5685,7 @@ int codx2s( status = 0; @@ -18511,7 +20340,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -5676,7 +5673,7 @@ int codx2s( +@@ -5676,7 +5700,7 @@ int codx2s( } @@ -18520,7 +20349,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -5704,7 +5701,7 @@ int codx2s( +@@ -5704,7 +5728,7 @@ int codx2s( } @@ -18529,7 +20358,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("codx2s"); } -@@ -5712,7 +5709,7 @@ int codx2s( +@@ -5712,7 +5736,7 @@ int codx2s( return status; } @@ -18538,7 +20367,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int cods2x( struct prjprm *prj, -@@ -5733,7 +5730,7 @@ int cods2x( +@@ -5733,7 +5757,7 @@ int cods2x( register const double *phip, *thetap; register double *xp, *yp; @@ -18547,7 +20376,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COD) { if ((status = codset(prj))) return status; -@@ -5749,7 +5746,7 @@ int cods2x( +@@ -5749,7 +5773,7 @@ int cods2x( } @@ -18556,7 +20385,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -5768,7 +5765,7 @@ int cods2x( +@@ -5768,7 +5792,7 @@ int cods2x( } @@ -18565,7 +20394,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -5873,7 +5870,7 @@ int cooset(struct prjprm *prj) +@@ -5873,7 +5897,7 @@ int cooset(struct prjprm *prj) return prjoff(prj, 0.0, prj->pv[1]); } @@ -18574,7 +20403,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int coox2s( struct prjprm *prj, -@@ -5894,7 +5891,7 @@ int coox2s( +@@ -5894,7 +5918,7 @@ int coox2s( register const double *xp, *yp; register double *phip, *thetap; @@ -18583,7 +20412,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COO) { if ((status = cooset(prj))) return status; -@@ -5912,7 +5909,7 @@ int coox2s( +@@ -5912,7 +5936,7 @@ int coox2s( status = 0; @@ -18592,7 +20421,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -5927,7 +5924,7 @@ int coox2s( +@@ -5927,7 +5951,7 @@ int coox2s( } @@ -18601,7 +20430,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -5968,7 +5965,7 @@ int coox2s( +@@ -5968,7 +5992,7 @@ int coox2s( } @@ -18610,7 +20439,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("coox2s"); } -@@ -5976,7 +5973,7 @@ int coox2s( +@@ -5976,7 +6000,7 @@ int coox2s( return status; } @@ -18619,7 +20448,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int coos2x( struct prjprm *prj, -@@ -5997,7 +5994,7 @@ int coos2x( +@@ -5997,7 +6021,7 @@ int coos2x( register const double *phip, *thetap; register double *xp, *yp; @@ -18628,7 +20457,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COO) { if ((status = cooset(prj))) return status; -@@ -6015,7 +6012,7 @@ int coos2x( +@@ -6015,7 +6039,7 @@ int coos2x( status = 0; @@ -18637,7 +20466,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -6034,7 +6031,7 @@ int coos2x( +@@ -6034,7 +6058,7 @@ int coos2x( } @@ -18646,7 +20475,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -6099,7 +6096,7 @@ int bonset(struct prjprm *prj) +@@ -6099,7 +6123,7 @@ int bonset(struct prjprm *prj) } if (prj->pv[1] == 0.0) { @@ -18655,7 +20484,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c return sflset(prj); } -@@ -6126,7 +6123,7 @@ int bonset(struct prjprm *prj) +@@ -6126,7 +6150,7 @@ int bonset(struct prjprm *prj) return prjoff(prj, 0.0, 0.0); } @@ -18664,7 +20493,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int bonx2s( struct prjprm *prj, -@@ -6148,10 +6145,10 @@ int bonx2s( +@@ -6148,10 +6172,10 @@ int bonx2s( register double *phip, *thetap; @@ -18677,7 +20506,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c return sflx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat); } -@@ -6171,7 +6168,7 @@ int bonx2s( +@@ -6171,7 +6195,7 @@ int bonx2s( status = 0; @@ -18686,7 +20515,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -6186,7 +6183,7 @@ int bonx2s( +@@ -6186,7 +6210,7 @@ int bonx2s( } @@ -18695,7 +20524,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -6222,7 +6219,7 @@ int bonx2s( +@@ -6222,7 +6246,7 @@ int bonx2s( } @@ -18704,7 +20533,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-11, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("bonx2s"); } -@@ -6230,7 +6227,7 @@ int bonx2s( +@@ -6230,7 +6254,7 @@ int bonx2s( return status; } @@ -18713,7 +20542,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int bons2x( struct prjprm *prj, -@@ -6251,10 +6248,10 @@ int bons2x( +@@ -6251,10 +6275,10 @@ int bons2x( register const double *phip, *thetap; register double *xp, *yp; @@ -18726,7 +20555,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c return sfls2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat); } -@@ -6274,7 +6271,7 @@ int bons2x( +@@ -6274,7 +6298,7 @@ int bons2x( y0 = prj->y0 - prj->w[2]; @@ -18735,7 +20564,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -6289,7 +6286,7 @@ int bons2x( +@@ -6289,7 +6313,7 @@ int bons2x( } @@ -18744,7 +20573,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -6366,7 +6363,7 @@ int pcoset(struct prjprm *prj) +@@ -6366,7 +6390,7 @@ int pcoset(struct prjprm *prj) return prjoff(prj, 0.0, 0.0); } @@ -18753,7 +20582,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int pcox2s( struct prjprm *prj, -@@ -6390,7 +6387,7 @@ int pcox2s( +@@ -6390,7 +6414,7 @@ int pcox2s( register double *phip, *thetap; @@ -18762,7 +20591,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != PCO) { if ((status = pcoset(prj))) return status; -@@ -6408,7 +6405,7 @@ int pcox2s( +@@ -6408,7 +6432,7 @@ int pcox2s( status = 0; @@ -18771,7 +20600,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -6423,7 +6420,7 @@ int pcox2s( +@@ -6423,7 +6447,7 @@ int pcox2s( } @@ -18780,7 +20609,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -6445,23 +6442,23 @@ int pcox2s( +@@ -6445,23 +6469,23 @@ int pcox2s( } else { if (w < 1.0e-4) { @@ -18808,7 +20637,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c lambda = fpos/(fpos-fneg); if (lambda < 0.1) { lambda = 0.1; -@@ -6470,16 +6467,16 @@ int pcox2s( +@@ -6470,16 +6494,16 @@ int pcox2s( } the = thepos - lambda*(thepos-theneg); @@ -18828,7 +20657,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (f > 0.0) { thepos = the; fpos = f; -@@ -6506,7 +6503,7 @@ int pcox2s( +@@ -6506,7 +6530,7 @@ int pcox2s( } @@ -18837,7 +20666,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-12, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("pcox2s"); } -@@ -6514,7 +6511,7 @@ int pcox2s( +@@ -6514,7 +6538,7 @@ int pcox2s( return status; } @@ -18846,7 +20675,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int pcos2x( struct prjprm *prj, -@@ -6535,7 +6532,7 @@ int pcos2x( +@@ -6535,7 +6559,7 @@ int pcos2x( register const double *phip, *thetap; register double *xp, *yp; @@ -18855,7 +20684,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != PCO) { if ((status = pcoset(prj))) return status; -@@ -6551,7 +6548,7 @@ int pcos2x( +@@ -6551,7 +6575,7 @@ int pcos2x( } @@ -18864,7 +20693,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -6564,7 +6561,7 @@ int pcos2x( +@@ -6564,7 +6588,7 @@ int pcos2x( } @@ -18873,7 +20702,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -6578,7 +6575,7 @@ int pcos2x( +@@ -6578,7 +6602,7 @@ int pcos2x( } } else if (fabs(*thetap) < 1.0e-4) { @@ -18882,7 +20711,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = prj->w[0]*(*xp)*cosd(*thetap) - prj->x0; *yp = (prj->w[0] + prj->w[3]*(*xp)*(*xp))*(*thetap) - prj->y0; -@@ -6653,7 +6650,7 @@ int tscset(struct prjprm *prj) +@@ -6653,7 +6677,7 @@ int tscset(struct prjprm *prj) return prjoff(prj, 0.0, 0.0); } @@ -18891,7 +20720,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int tscx2s( struct prjprm *prj, -@@ -6675,7 +6672,7 @@ int tscx2s( +@@ -6675,7 +6699,7 @@ int tscx2s( register double *phip, *thetap; @@ -18900,7 +20729,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != TSC) { if ((status = tscset(prj))) return status; -@@ -6693,7 +6690,7 @@ int tscx2s( +@@ -6693,7 +6717,7 @@ int tscx2s( status = 0; @@ -18909,7 +20738,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -6708,7 +6705,7 @@ int tscx2s( +@@ -6708,7 +6732,7 @@ int tscx2s( } @@ -18918,7 +20747,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -6719,7 +6716,7 @@ int tscx2s( +@@ -6719,7 +6743,7 @@ int tscx2s( for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xf = *phip; @@ -18927,7 +20756,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (fabs(xf) <= 1.0) { if (fabs(yf) > 3.0) { *phip = 0.0; -@@ -6738,42 +6735,42 @@ int tscx2s( +@@ -6738,42 +6762,42 @@ int tscx2s( } } @@ -18978,7 +20807,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c l = 1.0/sqrt(1.0 + xf*xf + yf*yf); m = l*xf; n = l*yf; -@@ -6791,7 +6788,7 @@ int tscx2s( +@@ -6791,7 +6815,7 @@ int tscx2s( } @@ -18987,7 +20816,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("tscx2s"); } -@@ -6799,7 +6796,7 @@ int tscx2s( +@@ -6799,7 +6823,7 @@ int tscx2s( return status; } @@ -18996,7 +20825,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int tscs2x( struct prjprm *prj, -@@ -6821,7 +6818,7 @@ int tscs2x( +@@ -6821,7 +6845,7 @@ int tscs2x( register const double *phip, *thetap; register double *xp, *yp; @@ -19005,7 +20834,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != TSC) { if ((status = tscset(prj))) return status; -@@ -6839,7 +6836,7 @@ int tscs2x( +@@ -6839,7 +6863,7 @@ int tscs2x( status = 0; @@ -19014,7 +20843,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -6857,7 +6854,7 @@ int tscs2x( +@@ -6857,7 +6881,7 @@ int tscs2x( } @@ -19023,7 +20852,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -6925,7 +6922,7 @@ int tscs2x( +@@ -6925,7 +6949,7 @@ int tscs2x( y0 = -2.0; break; default: @@ -19032,7 +20861,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xf = m/zeta; yf = -l/zeta; x0 = 0.0; -@@ -7009,7 +7006,7 @@ int cscset(struct prjprm *prj) +@@ -7009,7 +7033,7 @@ int cscset(struct prjprm *prj) return prjoff(prj, 0.0, 0.0); } @@ -19041,7 +20870,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int cscx2s( struct prjprm *prj, -@@ -7060,7 +7057,7 @@ int cscx2s( +@@ -7060,7 +7084,7 @@ int cscx2s( const float p15 = 0.52032238f; const float p06 = 0.14381585f; @@ -19050,7 +20879,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CSC) { if ((status = cscset(prj))) return status; -@@ -7078,7 +7075,7 @@ int cscx2s( +@@ -7078,7 +7102,7 @@ int cscx2s( status = 0; @@ -19059,7 +20888,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -7093,7 +7090,7 @@ int cscx2s( +@@ -7093,7 +7117,7 @@ int cscx2s( } @@ -19068,7 +20897,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -7104,7 +7101,7 @@ int cscx2s( +@@ -7104,7 +7128,7 @@ int cscx2s( for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xf = (float)(*phip); @@ -19077,7 +20906,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (fabs((double)xf) <= 1.0) { if (fabs((double)yf) > 3.0) { *phip = 0.0; -@@ -7123,10 +7120,10 @@ int cscx2s( +@@ -7123,10 +7147,10 @@ int cscx2s( } } @@ -19090,7 +20919,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (xf > 5.0f) { face = 4; xf = xf - 6.0f; -@@ -7201,7 +7198,7 @@ int cscx2s( +@@ -7201,7 +7225,7 @@ int cscx2s( m = -chi*n; break; default: @@ -19099,7 +20928,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c n = t; l = -psi*n; m = chi*n; -@@ -7220,7 +7217,7 @@ int cscx2s( +@@ -7220,7 +7244,7 @@ int cscx2s( } @@ -19108,7 +20937,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("cscx2s"); } -@@ -7228,7 +7225,7 @@ int cscx2s( +@@ -7228,7 +7252,7 @@ int cscx2s( return status; } @@ -19117,7 +20946,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int cscs2x( struct prjprm *prj, -@@ -7266,7 +7263,7 @@ int cscs2x( +@@ -7266,7 +7290,7 @@ int cscs2x( const float c02 = 0.106959469314f; @@ -19126,7 +20955,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CSC) { if ((status = cscset(prj))) return status; -@@ -7284,7 +7281,7 @@ int cscs2x( +@@ -7284,7 +7308,7 @@ int cscs2x( status = 0; @@ -19135,7 +20964,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -7302,7 +7299,7 @@ int cscs2x( +@@ -7302,7 +7326,7 @@ int cscs2x( } @@ -19144,7 +20973,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -7370,7 +7367,7 @@ int cscs2x( +@@ -7370,7 +7394,7 @@ int cscs2x( y0 = -2.0; break; default: @@ -19153,7 +20982,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xi = m; eta = -l; x0 = 0.0; -@@ -7386,7 +7383,7 @@ int cscs2x( +@@ -7386,7 +7410,7 @@ int cscs2x( chi2co = 1.0f - chi2; psi2co = 1.0f - psi2; @@ -19162,7 +20991,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c chipsi = (float)fabs((double)(chi*psi)); chi4 = (chi2 > 1.0e-16f) ? chi2*chi2 : 0.0f; psi4 = (psi2 > 1.0e-16f) ? psi2*psi2 : 0.0f; -@@ -7475,7 +7472,7 @@ int qscset(struct prjprm *prj) +@@ -7475,7 +7499,7 @@ int qscset(struct prjprm *prj) return prjoff(prj, 0.0, 0.0); } @@ -19171,7 +21000,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int qscx2s( struct prjprm *prj, -@@ -7498,7 +7495,7 @@ int qscx2s( +@@ -7498,7 +7522,7 @@ int qscx2s( register double *phip, *thetap; @@ -19180,7 +21009,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != QSC) { if ((status = qscset(prj))) return status; -@@ -7516,7 +7513,7 @@ int qscx2s( +@@ -7516,7 +7540,7 @@ int qscx2s( status = 0; @@ -19189,7 +21018,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -7531,7 +7528,7 @@ int qscx2s( +@@ -7531,7 +7555,7 @@ int qscx2s( } @@ -19198,7 +21027,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -7542,7 +7539,7 @@ int qscx2s( +@@ -7542,7 +7566,7 @@ int qscx2s( for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xf = *phip; @@ -19207,7 +21036,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (fabs(xf) <= 1.0) { if (fabs(yf) > 3.0) { *phip = 0.0; -@@ -7561,10 +7558,10 @@ int qscx2s( +@@ -7561,10 +7585,10 @@ int qscx2s( } } @@ -19220,7 +21049,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (xf > 5.0) { face = 4; xf -= 6.0; -@@ -7692,7 +7689,7 @@ int qscx2s( +@@ -7692,7 +7716,7 @@ int qscx2s( } break; default: @@ -19229,7 +21058,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c n = zeta; if (direct) { m = w; -@@ -7718,7 +7715,7 @@ int qscx2s( +@@ -7718,7 +7742,7 @@ int qscx2s( } @@ -19238,7 +21067,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-13, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("qscx2s"); } -@@ -7726,7 +7723,7 @@ int qscx2s( +@@ -7726,7 +7750,7 @@ int qscx2s( return status; } @@ -19247,7 +21076,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int qscs2x( struct prjprm *prj, -@@ -7750,7 +7747,7 @@ int qscs2x( +@@ -7750,7 +7774,7 @@ int qscs2x( register double *xp, *yp; @@ -19256,7 +21085,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != QSC) { if ((status = qscset(prj))) return status; -@@ -7768,7 +7765,7 @@ int qscs2x( +@@ -7768,7 +7792,7 @@ int qscs2x( status = 0; @@ -19265,7 +21094,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -7786,7 +7783,7 @@ int qscs2x( +@@ -7786,7 +7810,7 @@ int qscs2x( } @@ -19274,7 +21103,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -7836,7 +7833,7 @@ int qscs2x( +@@ -7836,7 +7860,7 @@ int qscs2x( xi = m; eta = n; if (zeco < 1.0e-8) { @@ -19283,7 +21112,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c t = (*thetap)*D2R; p = atan2(*yp, *xp); zeco = (p*p + t*t)/2.0; -@@ -7848,7 +7845,7 @@ int qscs2x( +@@ -7848,7 +7872,7 @@ int qscs2x( xi = -l; eta = n; if (zeco < 1.0e-8) { @@ -19292,7 +21121,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c t = (*thetap)*D2R; p = atan2(*yp, *xp) - PI/2.0; zeco = (p*p + t*t)/2.0; -@@ -7860,7 +7857,7 @@ int qscs2x( +@@ -7860,7 +7884,7 @@ int qscs2x( xi = -m; eta = n; if (zeco < 1.0e-8) { @@ -19301,7 +21130,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c t = (*thetap)*D2R; p = atan2(*yp, *xp); p -= copysign(PI, p); -@@ -7873,7 +7870,7 @@ int qscs2x( +@@ -7873,7 +7897,7 @@ int qscs2x( xi = l; eta = n; if (zeco < 1.0e-8) { @@ -19310,7 +21139,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c t = (*thetap)*D2R; p = atan2(*yp, *xp) + PI/2.0; zeco = (p*p + t*t)/2.0; -@@ -7885,7 +7882,7 @@ int qscs2x( +@@ -7885,7 +7909,7 @@ int qscs2x( xi = m; eta = l; if (zeco < 1.0e-8) { @@ -19319,7 +21148,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c t = (*thetap + 90.0)*D2R; zeco = t*t/2.0; } -@@ -7893,11 +7890,11 @@ int qscs2x( +@@ -7893,11 +7917,11 @@ int qscs2x( y0 = -2; break; default: @@ -19333,7 +21162,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c t = (90.0 - *thetap)*D2R; zeco = t*t/2.0; } -@@ -8041,7 +8038,7 @@ int hpxset(struct prjprm *prj) +@@ -8041,7 +8065,7 @@ int hpxset(struct prjprm *prj) return prjoff(prj, 0.0, 0.0); } @@ -19342,7 +21171,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int hpxx2s( struct prjprm *prj, -@@ -8063,7 +8060,7 @@ int hpxx2s( +@@ -8063,7 +8087,7 @@ int hpxx2s( register double *phip, *thetap; @@ -19351,7 +21180,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != HPX) { if ((status = hpxset(prj))) return status; -@@ -8084,20 +8081,20 @@ int hpxx2s( +@@ -8084,20 +8108,20 @@ int hpxx2s( status = 0; @@ -19375,7 +21204,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c *phip = s; *thetap = t; phip += rowlen; -@@ -8106,7 +8103,7 @@ int hpxx2s( +@@ -8106,7 +8130,7 @@ int hpxx2s( } @@ -19384,7 +21213,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -8117,7 +8114,7 @@ int hpxx2s( +@@ -8117,7 +8141,7 @@ int hpxx2s( istat = 0; if (absy <= prj->w[5]) { @@ -19393,7 +21222,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c t = asind(yr/prj->w[3]); for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { *thetap = t; -@@ -8125,7 +8122,7 @@ int hpxx2s( +@@ -8125,7 +8149,7 @@ int hpxx2s( } } else if (absy <= ylim) { @@ -19402,7 +21231,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c offset = (prj->n || *yp > 0.0) ? 0 : 1; sigma = prj->w[4] - absy / prj->w[6]; -@@ -8150,7 +8147,7 @@ int hpxx2s( +@@ -8150,7 +8174,7 @@ int hpxx2s( for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { if (offset) { @@ -19411,7 +21240,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c h = (int)floor(*phip / prj->w[6]) + prj->m; if (h%2) { *thetap -= prj->w[6]; -@@ -8159,10 +8156,10 @@ int hpxx2s( +@@ -8159,10 +8183,10 @@ int hpxx2s( } } @@ -19424,7 +21253,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&2) { if (slim <= fabs(r)) { istat = 1; -@@ -8178,7 +8175,7 @@ int hpxx2s( +@@ -8178,7 +8202,7 @@ int hpxx2s( } } else { @@ -19433,7 +21262,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { *phip = 0.0; *thetap = 0.0; -@@ -8189,7 +8186,7 @@ int hpxx2s( +@@ -8189,7 +8213,7 @@ int hpxx2s( } @@ -19442,7 +21271,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-12, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("hpxx2s"); } -@@ -8197,7 +8194,7 @@ int hpxx2s( +@@ -8197,7 +8221,7 @@ int hpxx2s( return status; } @@ -19451,7 +21280,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int hpxs2x( struct prjprm *prj, -@@ -8219,7 +8216,7 @@ int hpxs2x( +@@ -8219,7 +8243,7 @@ int hpxs2x( register double *xp, *yp; @@ -19460,7 +21289,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != HPX) { if ((status = hpxset(prj))) return status; -@@ -8235,21 +8232,21 @@ int hpxs2x( +@@ -8235,21 +8259,21 @@ int hpxs2x( } @@ -19485,7 +21314,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c *xp = xi; *yp = t; xp += rowlen; -@@ -8258,7 +8255,7 @@ int hpxs2x( +@@ -8258,7 +8282,7 @@ int hpxs2x( } @@ -19494,7 +21323,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -8268,7 +8265,7 @@ int hpxs2x( +@@ -8268,7 +8292,7 @@ int hpxs2x( abssin = fabs(sinthe); if (abssin <= prj->w[2]) { @@ -19503,7 +21332,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c eta = prj->w[8] * sinthe - prj->y0; for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *yp = eta; -@@ -8276,7 +8273,7 @@ int hpxs2x( +@@ -8276,7 +8300,7 @@ int hpxs2x( } } else { @@ -19512,7 +21341,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c offset = (prj->n || *thetap > 0.0) ? 0 : 1; sigma = sqrt(prj->pv[2]*(1.0 - abssin)); -@@ -8288,7 +8285,7 @@ int hpxs2x( +@@ -8288,7 +8312,7 @@ int hpxs2x( for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { if (offset) { @@ -19521,7 +21350,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c h = (int)floor((*xp + prj->x0) / prj->w[9]) + prj->m; if (h%2) { *yp -= prj->w[9]; -@@ -8297,12 +8294,12 @@ int hpxs2x( +@@ -8297,12 +8321,12 @@ int hpxs2x( } } @@ -19536,7 +21365,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (180.0 < *xp) *xp = 360.0 - *xp; } } -@@ -8375,7 +8372,7 @@ int xphset(struct prjprm *prj) +@@ -8375,7 +8399,7 @@ int xphset(struct prjprm *prj) return prjoff(prj, 0.0, 90.0); } @@ -19545,7 +21374,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int xphx2s( struct prjprm *prj, -@@ -8398,7 +8395,7 @@ int xphx2s( +@@ -8398,7 +8422,7 @@ int xphx2s( register double *phip, *thetap; @@ -19554,7 +21383,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != XPH) { if ((status = xphset(prj))) return status; -@@ -8416,7 +8413,7 @@ int xphx2s( +@@ -8416,7 +8440,7 @@ int xphx2s( status = 0; @@ -19563,7 +21392,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c xp = x; rowoff = 0; rowlen = nx*spt; -@@ -8431,7 +8428,7 @@ int xphx2s( +@@ -8431,7 +8455,7 @@ int xphx2s( } @@ -19572,7 +21401,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c yp = y; phip = phi; thetap = theta; -@@ -8466,12 +8463,12 @@ int xphx2s( +@@ -8466,12 +8490,12 @@ int xphx2s( if (abseta <= 90.0) { if (abseta <= 45.0) { @@ -19587,7 +21416,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&2) { if (45.0+tol < fabs(xi1)) { istat = 1; -@@ -8482,10 +8479,10 @@ int xphx2s( +@@ -8482,10 +8506,10 @@ int xphx2s( *(statp++) = istat; } else { @@ -19600,7 +21429,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (xr == 0.0) { if (yr <= 0.0) { *phip = 0.0; -@@ -8509,7 +8506,7 @@ int xphx2s( +@@ -8509,7 +8533,7 @@ int xphx2s( } if (eta < 0.0) *thetap = -(*thetap); @@ -19609,7 +21438,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c istat = 0; if (prj->bounds&2) { if (eta < -45.0 && eta+90.0+tol < fabs(xi1)) { -@@ -8522,7 +8519,7 @@ int xphx2s( +@@ -8522,7 +8546,7 @@ int xphx2s( } } else { @@ -19618,7 +21447,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c *phip = 0.0; *thetap = 0.0; *(statp++) = 1; -@@ -8532,7 +8529,7 @@ int xphx2s( +@@ -8532,7 +8556,7 @@ int xphx2s( } @@ -19627,7 +21456,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj->bounds&4 && prjbchk(1.0e-12, nx, my, spt, phi, theta, stat)) { if (!status) status = PRJERR_BAD_PIX_SET("xphx2s"); } -@@ -8540,7 +8537,7 @@ int xphx2s( +@@ -8540,7 +8564,7 @@ int xphx2s( return status; } @@ -19636,7 +21465,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c int xphs2x( struct prjprm *prj, -@@ -8562,7 +8559,7 @@ int xphs2x( +@@ -8562,7 +8586,7 @@ int xphs2x( register double *xp, *yp; @@ -19645,7 +21474,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != XPH) { if ((status = xphset(prj))) return status; -@@ -8578,7 +8575,7 @@ int xphs2x( +@@ -8578,7 +8602,7 @@ int xphs2x( } @@ -19654,7 +21483,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c phip = phi; rowoff = 0; rowlen = nphi*sxy; -@@ -8593,14 +8590,14 @@ int xphs2x( +@@ -8593,14 +8617,14 @@ int xphs2x( } } @@ -19671,7 +21500,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c *xp = psi; *yp = chi - 180.0; xp += rowlen; -@@ -8609,7 +8606,7 @@ int xphs2x( +@@ -8609,7 +8633,7 @@ int xphs2x( } @@ -19680,7 +21509,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c thetap = theta; xp = x; yp = y; -@@ -8620,12 +8617,12 @@ int xphs2x( +@@ -8620,12 +8644,12 @@ int xphs2x( for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { if (abssin <= prj->w[2]) { @@ -19695,7 +21524,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (*thetap < prj->w[5]) { sigma = sqrt(3.0*(1.0 - abssin)); } else { -@@ -8640,7 +8637,7 @@ int xphs2x( +@@ -8640,7 +8664,7 @@ int xphs2x( xi -= 45.0; eta -= 90.0; @@ -19704,16 +21533,16 @@ Index: astropy-4.2/cextern/wcslib/C/prj.c if (*yp < -90.0) { *xp = prj->w[0]*(-xi + eta) - prj->x0; *yp = prj->w[0]*(-xi - eta) - prj->y0; -Index: astropy-4.2/cextern/wcslib/C/prj.h +Index: astropy-4.2.1/cextern/wcslib/C/prj.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/prj.h -+++ astropy-4.2/cextern/wcslib/C/prj.h +--- astropy-4.2.1.orig/cextern/wcslib/C/prj.h ++++ astropy-4.2.1/cextern/wcslib/C/prj.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -19727,15 +21556,69 @@ Index: astropy-4.2/cextern/wcslib/C/prj.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: prj.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: prj.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: prj.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * -@@ -630,19 +627,19 @@ extern "C" { +@@ -54,7 +51,8 @@ + * + * Routine prjini() is provided to initialize the prjprm struct with default + * values, prjfree() reclaims any memory that may have been allocated to store +-* an error message, and prjprt() prints its contents. ++* an error message, prjsize() computes its total size including allocated ++* memory, and prjprt() prints its contents. + * + * prjperr() prints the error message(s) (if any) stored in a prjprm struct. + * prjbchk() performs bounds checking on native spherical coordinates. +@@ -76,7 +74,8 @@ + * In summary, the routines are: + * - prjini() Initialization routine for the prjprm struct. + * - prjfree() Reclaim memory allocated for error messages. +-* - prjprt() Print the prjprm struct. ++* - prjsize() Compute total size of a prjprm struct. ++* - prjprt() Print a prjprm struct. + * - prjperr() Print error message (if any). + * - prjbchk() Bounds checking on native coordinates. + * +@@ -184,6 +183,33 @@ + * 1: Null prjprm pointer passed. + * + * ++* prjsize() - Compute the size of a prjprm struct ++* ----------------------------------------------- ++* prjsize() computes the full size of a prjprm struct, including allocated ++* memory. ++* ++* Given: ++* prj const struct prjprm* ++* Projection parameters. ++* ++* If NULL, the base size of the struct and the allocated ++* size are both set to zero. ++* ++* Returned: ++* sizes int[2] The first element is the base size of the struct as ++* returned by sizeof(struct prjprm). The second element ++* is the total allocated size, in bytes. This figure ++* includes memory allocated for the constituent struct, ++* prjprm::err. ++* ++* It is not an error for the struct not to have been set ++* up via prjset(). ++* ++* Function return value: ++* int Status return value: ++* 0: Success. ++* ++* + * prjprt() - Print routine for the prjprm struct + * ---------------------------------------------- + * prjprt() prints the contents of a prjprm struct using wcsprintf(). Mainly +@@ -630,19 +656,19 @@ extern "C" { #endif @@ -19763,7 +21646,7 @@ Index: astropy-4.2/cextern/wcslib/C/prj.h }; extern const int CONIC, CONVENTIONAL, CYLINDRICAL, POLYCONIC, -@@ -660,59 +657,59 @@ extern const char prj_codes[28][4]; +@@ -660,66 +686,72 @@ extern const char prj_codes[28][4]; #undef PRJS2X_ARGS #endif @@ -19855,11 +21738,24 @@ Index: astropy-4.2/cextern/wcslib/C/prj.h -/* Use the preprocessor to help declare function prototypes (see above). */ -+// Use the preprocessor to help declare function prototypes (see above). int prjini(struct prjprm *prj); ++ int prjfree(struct prjprm *prj); ++ ++int prjsize(const struct prjprm *prj, int sizes[2]); ++ int prjprt(const struct prjprm *prj); -@@ -837,7 +834,7 @@ int xphx2s(PRJX2S_ARGS); ++ + int prjperr(const struct prjprm *prj, const char *prefix); ++ + int prjbchk(double tol, int nphi, int ntheta, int spt, double phi[], + double theta[], int stat[]); + ++// Use the preprocessor to help declare function prototypes (see above). + int prjset(struct prjprm *prj); + int prjx2s(PRJX2S_ARGS); + int prjs2x(PRJS2X_ARGS); +@@ -837,7 +869,7 @@ int xphx2s(PRJX2S_ARGS); int xphs2x(PRJS2X_ARGS); @@ -19868,22 +21764,22 @@ Index: astropy-4.2/cextern/wcslib/C/prj.h #define prjini_errmsg prj_errmsg #define prjprt_errmsg prj_errmsg #define prjset_errmsg prj_errmsg -@@ -848,4 +845,4 @@ int xphs2x(PRJS2X_ARGS); +@@ -848,4 +880,4 @@ int xphs2x(PRJS2X_ARGS); } #endif -#endif /* WCSLIB_PROJ */ +#endif // WCSLIB_PROJ -Index: astropy-4.2/cextern/wcslib/C/spc.c +Index: astropy-4.2.1/cextern/wcslib/C/spc.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/spc.c -+++ astropy-4.2/cextern/wcslib/C/spc.c +--- astropy-4.2.1.orig/cextern/wcslib/C/spc.c ++++ astropy-4.2.1/cextern/wcslib/C/spc.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -19897,7 +21793,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: spc.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: spc.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: spc.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -19995,16 +21891,41 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c int spcfree(struct spcprm *spc) -@@ -138,7 +135,7 @@ int spcfree(struct spcprm *spc) +@@ -138,7 +135,32 @@ int spcfree(struct spcprm *spc) return 0; } -/*--------------------------------------------------------------------------*/ ++//---------------------------------------------------------------------------- ++ ++int spcsize(const struct spcprm *spc, int sizes[2]) ++ ++{ ++ if (spc == 0x0) { ++ sizes[0] = sizes[1] = 0; ++ return SPCERR_SUCCESS; ++ } ++ ++ // Base size, in bytes. ++ sizes[0] = sizeof(struct spcprm); ++ ++ // Total size of allocated memory, in bytes. ++ sizes[1] = 0; ++ ++ int exsizes[2]; ++ ++ // spcprm::err. ++ wcserr_size(spc->err, exsizes); ++ sizes[1] += exsizes[0] + exsizes[1]; ++ ++ return SPCERR_SUCCESS; ++} ++ +//---------------------------------------------------------------------------- int spcprt(const struct spcprm *spc) -@@ -215,7 +212,7 @@ int spcprt(const struct spcprm *spc) +@@ -215,7 +237,7 @@ int spcprt(const struct spcprm *spc) return 0; } @@ -20013,7 +21934,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c int spcperr(const struct spcprm *spc, const char *prefix) -@@ -229,7 +226,7 @@ int spcperr(const struct spcprm *spc, co +@@ -229,7 +251,7 @@ int spcperr(const struct spcprm *spc, co return 0; } @@ -20022,7 +21943,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c int spcset(struct spcprm *spc) -@@ -257,7 +254,7 @@ int spcset(struct spcprm *spc) +@@ -257,7 +279,7 @@ int spcset(struct spcprm *spc) spc->w[0] = 0.0; @@ -20031,7 +21952,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c memset(ctype, 0, 9); memcpy(ctype, spc->type, 4); if (*(spc->code) != ' ') { -@@ -270,12 +267,12 @@ int spcset(struct spcprm *spc) +@@ -270,12 +292,12 @@ int spcset(struct spcprm *spc) return status; } @@ -20048,7 +21969,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c restwav = 1.0; } -@@ -302,34 +299,34 @@ int spcset(struct spcprm *spc) +@@ -302,34 +324,34 @@ int spcset(struct spcprm *spc) spc->w[2] = dXdS; @@ -20089,7 +22010,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c spc->flag = VRAD; spc->spxP2S = freqvrad; spc->spxS2P = vradfreq; -@@ -337,19 +334,19 @@ int spcset(struct spcprm *spc) +@@ -337,19 +359,19 @@ int spcset(struct spcprm *spc) } else if (ptype == 'W') { if (strcmp(spc->type, "WAVE") == 0) { @@ -20112,7 +22033,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c spc->flag = ZOPT; spc->spxP2S = wavezopt; spc->spxS2P = zoptwave; -@@ -357,7 +354,7 @@ int spcset(struct spcprm *spc) +@@ -357,7 +379,7 @@ int spcset(struct spcprm *spc) } else if (ptype == 'A') { if (strcmp(spc->type, "AWAV") == 0) { @@ -20121,7 +22042,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c spc->flag = AWAV; spc->spxP2S = 0x0; spc->spxS2P = 0x0; -@@ -365,13 +362,13 @@ int spcset(struct spcprm *spc) +@@ -365,13 +387,13 @@ int spcset(struct spcprm *spc) } else if (ptype == 'V') { if (strcmp(spc->type, "VELO") == 0) { @@ -20137,7 +22058,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c spc->flag = BETA; spc->spxP2S = velobeta; spc->spxS2P = betavelo; -@@ -379,11 +376,11 @@ int spcset(struct spcprm *spc) +@@ -379,11 +401,11 @@ int spcset(struct spcprm *spc) } @@ -20152,7 +22073,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (ptype == 'F') { spc->spxX2P = 0x0; spc->spxP2X = 0x0; -@@ -404,7 +401,7 @@ int spcset(struct spcprm *spc) +@@ -404,7 +426,7 @@ int spcset(struct spcprm *spc) spc->flag += F2S; } else if (xtype == 'W' || xtype == 'w') { @@ -20161,7 +22082,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (ptype == 'F') { spc->spxX2P = wavefreq; spc->spxP2X = freqwave; -@@ -425,13 +422,13 @@ int spcset(struct spcprm *spc) +@@ -425,13 +447,13 @@ int spcset(struct spcprm *spc) if (xtype == 'W') { spc->flag += W2S; } else { @@ -20177,7 +22098,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (ptype == 'F') { spc->spxX2P = awavfreq; spc->spxP2X = freqawav; -@@ -452,13 +449,13 @@ int spcset(struct spcprm *spc) +@@ -452,13 +474,13 @@ int spcset(struct spcprm *spc) if (xtype == 'A') { spc->flag += A2S; } else { @@ -20193,7 +22114,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (ptype == 'F') { spc->spxX2P = velofreq; spc->spxP2X = freqvelo; -@@ -480,12 +477,12 @@ int spcset(struct spcprm *spc) +@@ -480,12 +502,12 @@ int spcset(struct spcprm *spc) } @@ -20209,7 +22130,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (undefined(spc->pv[0])) spc->pv[0] = 0.0; if (undefined(spc->pv[1])) spc->pv[1] = 0.0; if (undefined(spc->pv[2])) spc->pv[2] = 0.0; -@@ -494,7 +491,7 @@ int spcset(struct spcprm *spc) +@@ -494,7 +516,7 @@ int spcset(struct spcprm *spc) if (undefined(spc->pv[5])) spc->pv[5] = 0.0; if (undefined(spc->pv[6])) spc->pv[6] = 0.0; @@ -20218,7 +22139,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c G = spc->pv[0]; m = spc->pv[1]; alpha = spc->pv[2]; -@@ -518,7 +515,7 @@ int spcset(struct spcprm *spc) +@@ -518,7 +540,7 @@ int spcset(struct spcprm *spc) return 0; } @@ -20227,7 +22148,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c int spcx2s( struct spcprm *spc, -@@ -540,7 +537,7 @@ int spcx2s( +@@ -540,7 +562,7 @@ int spcx2s( register double *specp; struct wcserr **err; @@ -20236,7 +22157,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (spc == 0x0) return SPCERR_NULL_POINTER; err = &(spc->err); -@@ -548,7 +545,7 @@ int spcx2s( +@@ -548,7 +570,7 @@ int spcx2s( if ((status = spcset(spc))) return status; } @@ -20245,7 +22166,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c xp = x; specp = spec; statp = stat; -@@ -557,7 +554,7 @@ int spcx2s( +@@ -557,7 +579,7 @@ int spcx2s( *(statp++) = 0; } @@ -20254,7 +22175,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (spc->isGrism) { specp = spec; for (ix = 0; ix < nx; ix++, specp += sspec) { -@@ -566,8 +563,8 @@ int spcx2s( +@@ -566,8 +588,8 @@ int spcx2s( } } @@ -20265,7 +22186,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (spc->spxX2P) { if ((statX2P = spc->spxX2P(spc->w[0], nx, sspec, sspec, spec, spec, stat))) { -@@ -582,8 +579,8 @@ int spcx2s( +@@ -582,8 +604,8 @@ int spcx2s( } } @@ -20276,7 +22197,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (spc->spxP2S) { if ((statP2S = spc->spxP2S(spc->w[0], nx, sspec, sspec, spec, spec, stat))) { -@@ -604,7 +601,7 @@ int spcx2s( +@@ -604,7 +626,7 @@ int spcx2s( return status; } @@ -20285,7 +22206,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c int spcs2x( struct spcprm *spc, -@@ -626,7 +623,7 @@ int spcs2x( +@@ -626,7 +648,7 @@ int spcs2x( register double *xp; struct wcserr **err; @@ -20294,7 +22215,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (spc == 0x0) return SPCERR_NULL_POINTER; err = &(spc->err); -@@ -634,8 +631,8 @@ int spcs2x( +@@ -634,8 +656,8 @@ int spcs2x( if ((status = spcset(spc))) return status; } @@ -20305,7 +22226,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (spc->spxS2P) { if ((statS2P = spc->spxS2P(spc->w[0], nspec, sspec, sx, spec, x, stat))) { if (statS2P == SPXERR_BAD_INSPEC_COORD) { -@@ -649,7 +646,7 @@ int spcs2x( +@@ -649,7 +671,7 @@ int spcs2x( } } else { @@ -20314,7 +22235,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c xp = x; specp = spec; statp = stat; -@@ -660,8 +657,8 @@ int spcs2x( +@@ -660,8 +682,8 @@ int spcs2x( } @@ -20325,7 +22246,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (spc->spxP2X) { if ((statP2X = spc->spxP2X(spc->w[0], nspec, sx, sx, x, x, stat))) { if (statP2X == SPCERR_BAD_SPEC) { -@@ -676,7 +673,7 @@ int spcs2x( +@@ -676,7 +698,7 @@ int spcs2x( } if (spc->isGrism) { @@ -20334,7 +22255,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c xp = x; statp = stat; for (ispec = 0; ispec < nspec; ispec++, xp += sx, statp++) { -@@ -693,7 +690,7 @@ int spcs2x( +@@ -693,7 +715,7 @@ int spcs2x( } @@ -20343,7 +22264,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c xp = x; statp = stat; for (ispec = 0; ispec < nspec; ispec++, xp += sx) { -@@ -709,7 +706,7 @@ int spcs2x( +@@ -709,7 +731,7 @@ int spcs2x( return status; } @@ -20352,7 +22273,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c int spctyp( const char ctypei[9], -@@ -726,7 +723,7 @@ int spctyp( +@@ -726,7 +748,7 @@ int spctyp( ctypei, stype, scode, sname, units, ptype, xtype, restreq, NULL); } @@ -20361,7 +22282,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c int spctype( const char ctypei[9], -@@ -747,11 +744,11 @@ int spctype( +@@ -747,11 +769,11 @@ int spctype( if (err) *err = 0x0; @@ -20375,7 +22296,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (strncmp(ctype, "FREQ", 4) == 0) { strcpy(sname_t, "Frequency"); strcpy(units_t, "Hz"); -@@ -805,9 +802,9 @@ int spctype( +@@ -805,9 +827,9 @@ int spctype( } @@ -20387,7 +22308,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (strcmp(ctype+4, " ") != 0) { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Invalid spectral algorithm '%s'", ctype+4); -@@ -820,21 +817,21 @@ int spctype( +@@ -820,21 +842,21 @@ int spctype( "Invalid spectral type '%s'", ctype); } else if (strcmp(ctype+5, "LOG") == 0 || strcmp(ctype+5, "TAB") == 0) { @@ -20414,7 +22335,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c xtype_t = 'a'; } else { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), -@@ -842,22 +839,22 @@ int spctype( +@@ -842,22 +864,22 @@ int spctype( } } else if (ctype[6] != '2') { @@ -20441,7 +22362,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (strchr("FWAwa", (int)xtype_t)) { if (ptype_t == 'V') { restreq_t += 2; -@@ -867,13 +864,13 @@ int spctype( +@@ -867,13 +889,13 @@ int spctype( restreq_t += 2; } } else if (strchr("LT", (int)xtype_t) == 0) { @@ -20457,7 +22378,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (stype) { memcpy(stype, ctype, 4); stype[4] = '\0'; -@@ -889,7 +886,7 @@ int spctype( +@@ -889,7 +911,7 @@ int spctype( return 0; } @@ -20466,7 +22387,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c int spcspx( const char ctypeS[9], -@@ -907,7 +904,7 @@ int spcspx( +@@ -907,7 +929,7 @@ int spcspx( crvalX, dXdS, 0x0); } @@ -20475,7 +22396,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c int spcspxe( const char ctypeS[9], -@@ -930,25 +927,25 @@ int spcspxe( +@@ -930,25 +952,25 @@ int spcspxe( struct spxprm spx; @@ -20505,7 +22426,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c strcpy(type, stype); spx.err = (err ? *err : 0x0); if ((status = specx(type, crvalS, restfrq, restwav, &spx))) { -@@ -964,7 +961,7 @@ int spcspxe( +@@ -964,7 +986,7 @@ int spcspxe( } @@ -20514,7 +22435,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c dPdS = 0.0; dXdP = 0.0; if (*ptype == 'F') { -@@ -1063,7 +1060,7 @@ int spcspxe( +@@ -1063,7 +1085,7 @@ int spcspxe( return 0; } @@ -20523,7 +22444,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c int spcxps( const char ctypeS[9], -@@ -1081,7 +1078,7 @@ int spcxps( +@@ -1081,7 +1103,7 @@ int spcxps( crvalS, dSdX, NULL); } @@ -20532,7 +22453,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c int spcxpse( const char ctypeS[9], -@@ -1103,25 +1100,25 @@ int spcxpse( +@@ -1103,25 +1125,25 @@ int spcxpse( double dPdX, dSdP; struct spxprm spx; @@ -20562,7 +22483,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (*xtype == 'F') { strcpy(type, "FREQ"); } else if (*xtype == 'W' || *xtype == 'w') { -@@ -1146,7 +1143,7 @@ int spcxpse( +@@ -1146,7 +1168,7 @@ int spcxpse( } @@ -20571,7 +22492,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c dPdX = 0.0; dSdP = 0.0; if (*ptype == 'F') { -@@ -1240,7 +1237,7 @@ int spcxpse( +@@ -1240,7 +1262,7 @@ int spcxpse( return 0; } @@ -20580,7 +22501,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c int spctrn( const char ctypeS1[9], -@@ -1257,7 +1254,7 @@ int spctrn( +@@ -1257,7 +1279,7 @@ int spctrn( ctypeS2, crvalS2, cdeltS2, NULL); } @@ -20589,7 +22510,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c int spctrne( const char ctypeS1[9], -@@ -1278,9 +1275,9 @@ int spctrne( +@@ -1278,9 +1300,9 @@ int spctrne( double crvalX, dS2dX, dXdS1; if (restfrq == 0.0 && restwav == 0.0) { @@ -20602,7 +22523,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c strncpy(stype1, ctypeS1, 4); strncpy(stype2, ctypeS2, 4); stype1[4] = stype2[4] = '\0'; -@@ -1295,13 +1292,13 @@ int spctrne( +@@ -1295,13 +1317,13 @@ int spctrne( return status; } @@ -20618,7 +22539,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (xtype1 == 'w') { strcpy(ctypeS2+5, "GRI"); } else if (xtype1 == 'a') { -@@ -1317,7 +1314,7 @@ int spctrne( +@@ -1317,7 +1339,7 @@ int spctrne( return status; } @@ -20627,7 +22548,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (xtype2 != xtype1) { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Incompatible X-types '%c' and '%c'", xtype1, xtype2); -@@ -1336,7 +1333,7 @@ int spctrne( +@@ -1336,7 +1358,7 @@ int spctrne( return 0; } @@ -20636,7 +22557,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c int spcaips( const char ctypeA[9], -@@ -1350,18 +1347,18 @@ int spcaips( +@@ -1350,18 +1372,18 @@ int spcaips( char *fcode; int ivf, status; @@ -20658,7 +22579,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c if (*(fcode = ctype+4)) { if (strcmp(fcode, "-LSR") == 0) { strcpy(specsys, "LSRK"); -@@ -1370,7 +1367,7 @@ int spcaips( +@@ -1370,7 +1392,7 @@ int spcaips( } else if (strcmp(fcode, "-OBS") == 0) { strcpy(specsys, "TOPOCENT"); } else { @@ -20667,7 +22588,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c return SPCERR_NO_CHANGE; } -@@ -1378,7 +1375,7 @@ int spcaips( +@@ -1378,7 +1400,7 @@ int spcaips( status = 0; } @@ -20676,7 +22597,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c ivf = velref%256; if (0 < ivf && ivf <= 7) { strcpy(specsys, frames[ivf-1]); -@@ -1388,9 +1385,9 @@ int spcaips( +@@ -1388,9 +1410,9 @@ int spcaips( } if (strcmp(ctype, "VELO") == 0) { @@ -20688,7 +22609,7 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c ivf = velref/256; if (ivf == 0) { strcpy(ctype, "VOPT"); -@@ -1401,8 +1398,8 @@ int spcaips( +@@ -1401,8 +1423,8 @@ int spcaips( } } } else if (strcmp(ctype, "FELO") == 0) { @@ -20699,16 +22620,16 @@ Index: astropy-4.2/cextern/wcslib/C/spc.c strcpy(ctype, "VOPT-F2W"); if (status < 0) status = 0; } -Index: astropy-4.2/cextern/wcslib/C/spc.h +Index: astropy-4.2.1/cextern/wcslib/C/spc.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/spc.h -+++ astropy-4.2/cextern/wcslib/C/spc.h +--- astropy-4.2.1.orig/cextern/wcslib/C/spc.h ++++ astropy-4.2.1/cextern/wcslib/C/spc.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -20722,15 +22643,59 @@ Index: astropy-4.2/cextern/wcslib/C/spc.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: spc.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: spc.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: spc.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * -@@ -794,67 +791,67 @@ extern "C" { +@@ -52,7 +49,8 @@ + * + * Routine spcini() is provided to initialize the spcprm struct with default + * values, spcfree() reclaims any memory that may have been allocated to store +-* an error message, and spcprt() prints its contents. ++* an error message, spcsize() computes its total size including allocated ++* memory, and spcprt() prints its contents. + * + * spcperr() prints the error message(s) (if any) stored in a spcprm struct. + * +@@ -213,6 +211,33 @@ + * 1: Null spcprm pointer passed. + * + * ++* spcsize() - Compute the size of a spcprm struct ++* ----------------------------------------------- ++* spcsize() computes the full size of a spcprm struct, including allocated ++* memory. ++* ++* Given: ++* spc const struct spcprm* ++* Spectral transformation parameters. ++* ++* If NULL, the base size of the struct and the allocated ++* size are both set to zero. ++* ++* Returned: ++* sizes int[2] The first element is the base size of the struct as ++* returned by sizeof(struct spcprm). The second element ++* is the total allocated size, in bytes. This figure ++* includes memory allocated for the constituent struct, ++* spcprm::err. ++* ++* It is not an error for the struct not to have been set ++* up via spcset(). ++* ++* Function return value: ++* int Status return value: ++* 0: Success. ++* ++* + * spcprt() - Print routine for the spcprm struct + * ---------------------------------------------- + * spcprt() prints the contents of a spcprm struct using wcsprintf(). Mainly +@@ -794,67 +819,67 @@ extern "C" { extern const char *spc_errmsg[]; enum spc_errmsg_enum { @@ -20850,7 +22815,16 @@ Index: astropy-4.2/cextern/wcslib/C/spc.h #define SPCLEN (sizeof(struct spcprm)/sizeof(int)) -@@ -893,7 +890,7 @@ int spctrne(const char ctypeS1[9], doubl +@@ -862,6 +887,8 @@ int spcini(struct spcprm *spc); + + int spcfree(struct spcprm *spc); + ++int spcsize(const struct spcprm *spc, int sizes[2]); ++ + int spcprt(const struct spcprm *spc); + + int spcperr(const struct spcprm *spc, const char *prefix); +@@ -893,7 +920,7 @@ int spctrne(const char ctypeS1[9], doubl int spcaips(const char ctypeA[9], int velref, char ctype[9], char specsys[9]); @@ -20859,22 +22833,22 @@ Index: astropy-4.2/cextern/wcslib/C/spc.h #define spcini_errmsg spc_errmsg #define spcprt_errmsg spc_errmsg #define spcset_errmsg spc_errmsg -@@ -916,4 +913,4 @@ int spctrn(const char ctypeS1[9], double +@@ -916,4 +943,4 @@ int spctrn(const char ctypeS1[9], double } #endif -#endif /* WCSLIB_SPC */ +#endif // WCSLIB_SPC -Index: astropy-4.2/cextern/wcslib/C/sph.c +Index: astropy-4.2.1/cextern/wcslib/C/sph.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/sph.c -+++ astropy-4.2/cextern/wcslib/C/sph.c +--- astropy-4.2.1.orig/cextern/wcslib/C/sph.c ++++ astropy-4.2.1/cextern/wcslib/C/sph.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -20888,7 +22862,7 @@ Index: astropy-4.2/cextern/wcslib/C/sph.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: sph.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: sph.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: sph.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -21194,16 +23168,16 @@ Index: astropy-4.2/cextern/wcslib/C/sph.c sphx2s(eul, nfield, 0, 1, 1, lng, lat, lng, lat); return 0; -Index: astropy-4.2/cextern/wcslib/C/sph.h +Index: astropy-4.2.1/cextern/wcslib/C/sph.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/sph.h -+++ astropy-4.2/cextern/wcslib/C/sph.h +--- astropy-4.2.1.orig/cextern/wcslib/C/sph.h ++++ astropy-4.2.1/cextern/wcslib/C/sph.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -21217,11 +23191,11 @@ Index: astropy-4.2/cextern/wcslib/C/sph.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: sph.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: sph.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: sph.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * @@ -21325,16 +23299,16 @@ Index: astropy-4.2/cextern/wcslib/C/sph.h -#endif /* WCSLIB_SPH */ +#endif // WCSLIB_SPH -Index: astropy-4.2/cextern/wcslib/C/spx.c +Index: astropy-4.2.1/cextern/wcslib/C/spx.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/spx.c -+++ astropy-4.2/cextern/wcslib/C/spx.c +--- astropy-4.2.1.orig/cextern/wcslib/C/spx.c ++++ astropy-4.2.1/cextern/wcslib/C/spx.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -21348,7 +23322,7 @@ Index: astropy-4.2/cextern/wcslib/C/spx.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: spx.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: spx.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: spx.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -21678,16 +23652,16 @@ Index: astropy-4.2/cextern/wcslib/C/spx.c (void)dummy; betap = beta; -Index: astropy-4.2/cextern/wcslib/C/spx.h +Index: astropy-4.2.1/cextern/wcslib/C/spx.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/spx.h -+++ astropy-4.2/cextern/wcslib/C/spx.h +--- astropy-4.2.1.orig/cextern/wcslib/C/spx.h ++++ astropy-4.2.1/cextern/wcslib/C/spx.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -21701,11 +23675,11 @@ Index: astropy-4.2/cextern/wcslib/C/spx.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: spx.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: spx.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: spx.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * @@ -21829,16 +23803,16 @@ Index: astropy-4.2/cextern/wcslib/C/spx.h -#endif /* WCSLIB_SPEC */ +#endif // WCSLIB_SPEC -Index: astropy-4.2/cextern/wcslib/C/tab.c +Index: astropy-4.2.1/cextern/wcslib/C/tab.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/tab.c -+++ astropy-4.2/cextern/wcslib/C/tab.c +--- astropy-4.2.1.orig/cextern/wcslib/C/tab.c ++++ astropy-4.2.1/cextern/wcslib/C/tab.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -21852,7 +23826,7 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: tab.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: tab.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: tab.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -21865,7 +23839,7 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c const char *tab_errmsg[] = { "Success", "Null tabprm pointer passed", -@@ -47,10 +44,10 @@ const char *tab_errmsg[] = { +@@ -47,27 +44,23 @@ const char *tab_errmsg[] = { "One or more of the x coordinates were invalid", "One or more of the world coordinates were invalid"}; @@ -21878,8 +23852,13 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c int tabini(int alloc, int M, const int K[], struct tabprm *tab) -@@ -63,7 +60,7 @@ int tabini(int alloc, int M, const int K + { + static const char *function = "tabini"; +- int k, m, N; +- double *dp; +- struct wcserr **err; +- if (tab == 0x0) return TABERR_NULL_POINTER; - /* Initialize error message handling. */ @@ -21887,16 +23866,27 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c if (tab->flag == -1) { tab->err = 0x0; } -@@ -76,7 +73,7 @@ int tabini(int alloc, int M, const int K +- err = &(tab->err); ++ struct wcserr **err = &(tab->err); + wcserr_clear(err); + + +@@ -76,11 +69,12 @@ int tabini(int alloc, int M, const int K "M must be positive, got %d", M); } - /* Determine the total number of elements in the coordinate array. */ + // Determine the total number of elements in the coordinate array. ++ int N; if (K) { N = M; -@@ -91,12 +88,12 @@ int tabini(int alloc, int M, const int K +- for (m = 0; m < M; m++) { ++ for (int m = 0; m < M; m++) { + if (K[m] < 0) { + return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), + "Invalid tabular parameters: Each element of K must be " +@@ -91,12 +85,12 @@ int tabini(int alloc, int M, const int K } } else { @@ -21911,16 +23901,18 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c if (tab->flag == -1 || tab->m_flag != TABSET) { if (tab->flag == -1) { tab->sense = 0x0; -@@ -117,7 +114,7 @@ int tabini(int alloc, int M, const int K +@@ -117,8 +111,8 @@ int tabini(int alloc, int M, const int K tab->m_coord = 0x0; } else { - /* Clear any outstanding signals set by wcstab(). */ +- for (m = 0; m < tab->m_M; m++) { + // Clear any outstanding signals set by wcstab(). - for (m = 0; m < tab->m_M; m++) { ++ for (int m = 0; m < tab->m_M; m++) { if (tab->m_indxs[m] == (double *)0x1) tab->m_indxs[m] = 0x0; } -@@ -126,7 +123,7 @@ int tabini(int alloc, int M, const int K + +@@ -126,7 +120,7 @@ int tabini(int alloc, int M, const int K } @@ -21929,7 +23921,7 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c if (alloc || tab->K == 0x0 || tab->map == 0x0 || -@@ -134,15 +131,15 @@ int tabini(int alloc, int M, const int K +@@ -134,15 +128,15 @@ int tabini(int alloc, int M, const int K tab->index == 0x0 || tab->coord == 0x0) { @@ -21948,7 +23940,7 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c tab->K = tab->m_K; } else { -@@ -158,7 +155,7 @@ int tabini(int alloc, int M, const int K +@@ -158,7 +152,7 @@ int tabini(int alloc, int M, const int K if (alloc || tab->map == 0x0) { if (tab->m_map) { @@ -21957,7 +23949,7 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c tab->map = tab->m_map; } else { -@@ -174,7 +171,7 @@ int tabini(int alloc, int M, const int K +@@ -174,7 +168,7 @@ int tabini(int alloc, int M, const int K if (alloc || tab->crval == 0x0) { if (tab->m_crval) { @@ -21966,7 +23958,7 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c tab->crval = tab->m_crval; } else { -@@ -190,7 +187,7 @@ int tabini(int alloc, int M, const int K +@@ -190,7 +184,7 @@ int tabini(int alloc, int M, const int K if (alloc || tab->index == 0x0) { if (tab->m_index) { @@ -21975,16 +23967,19 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c tab->index = tab->m_index; } else { -@@ -207,7 +204,7 @@ int tabini(int alloc, int M, const int K +@@ -207,9 +201,9 @@ int tabini(int alloc, int M, const int K return wcserr_set(TAB_ERRMSG(TABERR_MEMORY)); } - /* Recall that calloc() initializes these pointers to zero. */ + // Recall that calloc() initializes these pointers to zero. if (K) { - for (m = 0; m < M; m++) { +- for (m = 0; m < M; m++) { ++ for (int m = 0; m < M; m++) { if (K[m]) { -@@ -224,7 +221,7 @@ int tabini(int alloc, int M, const int K + if (!(tab->index[m] = calloc(K[m], sizeof(double)))) { + return wcserr_set(TAB_ERRMSG(TABERR_MEMORY)); +@@ -224,7 +218,7 @@ int tabini(int alloc, int M, const int K if (alloc || tab->coord == 0x0) { if (tab->m_coord) { @@ -21993,25 +23988,37 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c tab->coord = tab->m_coord; } else if (N) { -@@ -243,7 +240,7 @@ int tabini(int alloc, int M, const int K +@@ -243,15 +237,16 @@ int tabini(int alloc, int M, const int K tab->flag = 0; tab->M = M; - /* Set defaults. */ +- for (m = 0; m < M; m++) { + // Set defaults. - for (m = 0; m < M; m++) { ++ for (int m = 0; m < M; m++) { tab->map[m] = -1; tab->crval[m] = 0.0; -@@ -260,7 +257,7 @@ int tabini(int alloc, int M, const int K + + if (K) { + tab->K[m] = K[m]; ++ double *dp; + if ((dp = tab->index[m])) { +- for (k = 0; k < K[m]; k++) { ++ for (int k = 0; k < K[m]; k++) { + *(dp++) = k; + } + } +@@ -260,36 +255,34 @@ int tabini(int alloc, int M, const int K } } - /* Initialize the coordinate array. */ +- for (dp = tab->coord; dp < tab->coord + N; dp++) { + // Initialize the coordinate array. - for (dp = tab->coord; dp < tab->coord + N; dp++) { ++ for (double *dp = tab->coord; dp < tab->coord + N; dp++) { *dp = UNDEFINED; } -@@ -268,7 +265,7 @@ int tabini(int alloc, int M, const int K + return 0; } @@ -22020,8 +24027,15 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c int tabmem(struct tabprm *tab) -@@ -282,7 +279,7 @@ int tabmem(struct tabprm *tab) - err = &(tab->err); + { + static const char *function = "tabmem"; + +- int m, M, N; +- struct wcserr **err; +- + if (tab == 0x0) return TABERR_NULL_POINTER; +- err = &(tab->err); ++ struct wcserr **err = &(tab->err); if (tab->M == 0 || tab->K == 0x0) { - /* Should have been set by this time. */ @@ -22029,7 +24043,17 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c return wcserr_set(WCSERR_SET(TABERR_MEMORY), "Null pointers in tabprm struct"); } -@@ -303,7 +300,7 @@ int tabmem(struct tabprm *tab) + + +- N = M = tab->M; +- for (m = 0; m < M; m++) { ++ int M = tab->M; ++ int N = tab->M; ++ for (int m = 0; m < M; m++) { + if (tab->K[m] < 0) { + return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), + "Invalid tabular parameters: Each element of K must be " +@@ -303,7 +296,7 @@ int tabmem(struct tabprm *tab) if (tab->m_M == 0) { tab->m_M = M; } else if (tab->m_M < M) { @@ -22038,7 +24062,7 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c return wcserr_set(WCSERR_SET(TABERR_MEMORY), "tabprm struct inconsistent"); } -@@ -311,7 +308,7 @@ int tabmem(struct tabprm *tab) +@@ -311,7 +304,7 @@ int tabmem(struct tabprm *tab) if (tab->m_N == 0) { tab->m_N = N; } else if (tab->m_N < N) { @@ -22047,7 +24071,16 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c return wcserr_set(WCSERR_SET(TABERR_MEMORY), "tabprm struct inconsistent"); } -@@ -359,7 +356,7 @@ int tabmem(struct tabprm *tab) +@@ -340,7 +333,7 @@ int tabmem(struct tabprm *tab) + } + } + +- for (m = 0; m < tab->m_M; m++) { ++ for (int m = 0; m < tab->m_M; m++) { + if (tab->m_indxs[m] == 0x0 || tab->m_indxs[m] == (double *)0x1) { + if ((tab->m_indxs[m] = tab->index[m])) { + tab->m_flag = TABSET; +@@ -359,22 +352,20 @@ int tabmem(struct tabprm *tab) return 0; } @@ -22056,7 +24089,56 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c int tabcpy(int alloc, const struct tabprm *tabsrc, struct tabprm *tabdst) -@@ -409,7 +406,7 @@ int tabcpy(int alloc, const struct tabpr + { + static const char *function = "tabcpy"; + +- int k, m, M, n, N, status; +- double *dstp, *srcp; +- struct wcserr **err; ++ int status; + + if (tabsrc == 0x0) return TABERR_NULL_POINTER; + if (tabdst == 0x0) return TABERR_NULL_POINTER; +- err = &(tabdst->err); ++ struct wcserr **err = &(tabdst->err); + +- M = tabsrc->M; ++ int M = tabsrc->M; + if (M <= 0) { + return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), + "M must be positive, got %d", M); +@@ -384,17 +375,18 @@ int tabcpy(int alloc, const struct tabpr + return status; + } + +- N = M; +- for (m = 0; m < M; m++) { ++ int N = M; ++ for (int m = 0; m < M; m++) { + tabdst->map[m] = tabsrc->map[m]; + tabdst->crval[m] = tabsrc->crval[m]; + N *= tabsrc->K[m]; + } + +- for (m = 0; m < M; m++) { ++ double *dstp, *srcp; ++ for (int m = 0; m < M; m++) { + if ((srcp = tabsrc->index[m])) { + dstp = tabdst->index[m]; +- for (k = 0; k < tabsrc->K[m]; k++) { ++ for (int k = 0; k < tabsrc->K[m]; k++) { + *(dstp++) = *(srcp++); + } + } +@@ -402,14 +394,14 @@ int tabcpy(int alloc, const struct tabpr + + srcp = tabsrc->coord; + dstp = tabdst->coord; +- for (n = 0; n < N; n++) { ++ for (int n = 0; n < N; n++) { + *(dstp++) = *(srcp++); + } + return 0; } @@ -22065,16 +24147,49 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c int tabcmp( int dummy, -@@ -421,7 +418,7 @@ int tabcmp( - { - int m, M, N; +@@ -419,9 +411,7 @@ int tabcmp( + int *equal) + { +- int m, M, N; +- - /* Avert nuisance compiler warnings about unused parameters. */ + // Avert nuisance compiler warnings about unused parameters. (void)dummy; if (tab1 == 0x0) return TABERR_NULL_POINTER; -@@ -461,7 +458,7 @@ int tabcmp( +@@ -434,24 +424,24 @@ int tabcmp( + return 0; + } + +- M = tab1->M; ++ int M = tab1->M; + + if (!wcsutil_intEq(M, tab1->K, tab2->K) || + !wcsutil_intEq(M, tab1->map, tab2->map) || +- !wcsutil_Eq(M, tol, tab1->crval, tab2->crval)) { ++ !wcsutil_dblEq(M, tol, tab1->crval, tab2->crval)) { + return 0; + } + +- N = M; +- for (m = 0; m < M; m++) { +- if (!wcsutil_Eq(tab1->K[m], tol, tab1->index[m], tab2->index[m])) { ++ int N = M; ++ for (int m = 0; m < M; m++) { ++ if (!wcsutil_dblEq(tab1->K[m], tol, tab1->index[m], tab2->index[m])) { + return 0; + } + + N *= tab1->K[m]; + } + +- if (!wcsutil_Eq(N, tol, tab1->coord, tab2->coord)) { ++ if (!wcsutil_dblEq(N, tol, tab1->coord, tab2->coord)) { + return 0; + } + +@@ -461,24 +451,22 @@ int tabcmp( } @@ -22083,13 +24198,16 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c int tabfree(struct tabprm *tab) -@@ -471,14 +468,14 @@ int tabfree(struct tabprm *tab) + { +- int m; +- if (tab == 0x0) return TABERR_NULL_POINTER; if (tab->flag != -1) { - /* Clear any outstanding signals set by wcstab(). */ +- for (m = 0; m < tab->m_M; m++) { + // Clear any outstanding signals set by wcstab(). - for (m = 0; m < tab->m_M; m++) { ++ for (int m = 0; m < tab->m_M; m++) { if (tab->m_indxs[m] == (double *)0x1) tab->m_indxs[m] = 0x0; } @@ -22100,7 +24218,16 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c if (tab->m_flag == TABSET) { if (tab->K == tab->m_K) tab->K = 0x0; if (tab->map == tab->m_map) tab->map = 0x0; -@@ -501,7 +498,7 @@ int tabfree(struct tabprm *tab) +@@ -491,7 +479,7 @@ int tabfree(struct tabprm *tab) + if (tab->m_crval) free(tab->m_crval); + + if (tab->m_index) { +- for (m = 0; m < tab->m_M; m++) { ++ for (int m = 0; m < tab->m_M; m++) { + if (tab->m_indxs[m]) free(tab->m_indxs[m]); + } + free(tab->m_index); +@@ -501,7 +489,7 @@ int tabfree(struct tabprm *tab) if (tab->m_coord) free(tab->m_coord); } @@ -22109,16 +24236,92 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c if (tab->sense) free(tab->sense); if (tab->p0) free(tab->p0); if (tab->delta) free(tab->delta); -@@ -531,7 +528,7 @@ int tabfree(struct tabprm *tab) +@@ -531,13 +519,82 @@ int tabfree(struct tabprm *tab) return 0; } -/*--------------------------------------------------------------------------*/ ++//---------------------------------------------------------------------------- ++ ++int tabsize(const struct tabprm *tab, int sizes[2]) ++ ++{ ++ if (tab == 0x0) { ++ sizes[0] = sizes[1] = 0; ++ return TABERR_SUCCESS; ++ } ++ ++ // Base size, in bytes. ++ sizes[0] = sizeof(struct tabprm); ++ ++ // Total size of allocated memory, in bytes. ++ sizes[1] = 0; ++ ++ int exsizes[2]; ++ int M = tab->M; ++ ++ // tabprm::K[]; ++ sizes[1] += M * sizeof(int); ++ ++ // tabprm::map[]; ++ sizes[1] += M * sizeof(int); ++ ++ // tabprm::crval[]; ++ sizes[1] += M * sizeof(double); ++ ++ // tabprm::index[] and tabprm::m_indxs; ++ sizes[1] += 2*M * sizeof(double *); ++ for (int m = 0; m < M; m++) { ++ if (tab->index[m]) { ++ sizes[1] += tab->K[m] * sizeof(double); ++ } ++ } ++ ++ // tabprm::coord[]; ++ sizes[1] += M * tab->nc * sizeof(double); ++ ++ // tab::err[]. ++ wcserr_size(tab->err, exsizes); ++ sizes[1] += exsizes[0] + exsizes[1]; ++ ++ // The remaining arrays are allocated by tabset(). ++ if (tab->flag != TABSET) { ++ return TABERR_SUCCESS; ++ } ++ ++ // tabprm::sense[]. ++ if (tab->sense) { ++ sizes[1] += M * sizeof(int); ++ } ++ ++ // tabprm::p0[]. ++ if (tab->p0) { ++ sizes[1] += M * sizeof(int); ++ } ++ ++ // tabprm::delta[]. ++ if (tab->delta) { ++ sizes[1] += M * sizeof(double); ++ } ++ ++ // tabprm::extrema[]. ++ int ne = (tab->nc / tab->K[0]) * 2 * M; ++ sizes[1] += ne * sizeof(double); ++ ++ return TABERR_SUCCESS; ++} ++ +//---------------------------------------------------------------------------- int tabprt(const struct tabprm *tab) -@@ -550,7 +547,7 @@ int tabprt(const struct tabprm *tab) + { + char *cp, text[128]; +- int j, k, m, n, nd; + double *dp; + + if (tab == 0x0) return TABERR_NULL_POINTER; +@@ -550,37 +607,37 @@ int tabprt(const struct tabprm *tab) wcsprintf(" flag: %d\n", tab->flag); wcsprintf(" M: %d\n", tab->M); @@ -22126,8 +24329,9 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c + // Array dimensions. WCSPRINTF_PTR(" K: ", tab->K, "\n"); wcsprintf(" "); - for (m = 0; m < tab->M; m++) { -@@ -558,7 +555,7 @@ int tabprt(const struct tabprm *tab) +- for (m = 0; m < tab->M; m++) { ++ for (int m = 0; m < tab->M; m++) { + wcsprintf("%6d", tab->K[m]); } wcsprintf("\n"); @@ -22135,8 +24339,9 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c + // Map vector. WCSPRINTF_PTR(" map: ", tab->map, "\n"); wcsprintf(" "); - for (m = 0; m < tab->M; m++) { -@@ -566,7 +563,7 @@ int tabprt(const struct tabprm *tab) +- for (m = 0; m < tab->M; m++) { ++ for (int m = 0; m < tab->M; m++) { + wcsprintf("%6d", tab->map[m]); } wcsprintf("\n"); @@ -22144,17 +24349,26 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c + // Reference index value. WCSPRINTF_PTR(" crval: ", tab->crval, "\n"); wcsprintf(" "); - for (m = 0; m < tab->M; m++) { -@@ -574,7 +571,7 @@ int tabprt(const struct tabprm *tab) +- for (m = 0; m < tab->M; m++) { ++ for (int m = 0; m < tab->M; m++) { + wcsprintf(" %#- 11.5g", tab->crval[m]); } wcsprintf("\n"); - /* Index vectors. */ + // Index vectors. WCSPRINTF_PTR(" index: ", tab->index, "\n"); - for (m = 0; m < tab->M; m++) { +- for (m = 0; m < tab->M; m++) { ++ for (int m = 0; m < tab->M; m++) { wcsprintf(" index[%d]: ", m); -@@ -590,11 +587,11 @@ int tabprt(const struct tabprm *tab) + WCSPRINTF_PTR("", tab->index[m], ""); + if (tab->index[m]) { +- for (k = 0; k < tab->K[m]; k++) { ++ for (int k = 0; k < tab->K[m]; k++) { + if (k%5 == 0) { + wcsprintf("\n "); + } +@@ -590,22 +647,22 @@ int tabprt(const struct tabprm *tab) } } @@ -22162,22 +24376,83 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c + // Coordinate array. WCSPRINTF_PTR(" coord: ", tab->coord, "\n"); dp = tab->coord; - for (n = 0; n < tab->nc; n++) { +- for (n = 0; n < tab->nc; n++) { - /* Array index. */ +- j = n; ++ for (int n = 0; n < tab->nc; n++) { + // Array index. - j = n; ++ int j = n; cp = text; - for (m = 0; m < tab->M; m++) { -@@ -643,7 +640,7 @@ int tabprt(const struct tabprm *tab) +- for (m = 0; m < tab->M; m++) { +- nd = (tab->K[m] < 10) ? 1 : 2; ++ for (int m = 0; m < tab->M; m++) { ++ int nd = (tab->K[m] < 10) ? 1 : 2; + sprintf(cp, ",%*d", nd, j % tab->K[m] + 1); + j /= tab->K[m]; + cp += strlen(cp); + } + + wcsprintf(" (*%s)", text); +- for (m = 0; m < tab->M; m++) { ++ for (int m = 0; m < tab->M; m++) { + wcsprintf(" %#- 11.5g", *(dp++)); + } + wcsprintf("\n"); +@@ -616,7 +673,7 @@ int tabprt(const struct tabprm *tab) + WCSPRINTF_PTR(" sense: ", tab->sense, "\n"); + if (tab->sense) { + wcsprintf(" "); +- for (m = 0; m < tab->M; m++) { ++ for (int m = 0; m < tab->M; m++) { + wcsprintf("%6d", tab->sense[m]); + } + wcsprintf("\n"); +@@ -625,7 +682,7 @@ int tabprt(const struct tabprm *tab) + WCSPRINTF_PTR(" p0: ", tab->p0, "\n"); + if (tab->p0) { + wcsprintf(" "); +- for (m = 0; m < tab->M; m++) { ++ for (int m = 0; m < tab->M; m++) { + wcsprintf("%6d", tab->p0[m]); + } + wcsprintf("\n"); +@@ -634,7 +691,7 @@ int tabprt(const struct tabprm *tab) + WCSPRINTF_PTR(" delta: ", tab->delta, "\n"); + if (tab->delta) { + wcsprintf(" "); +- for (m = 0; m < tab->M; m++) { ++ for (int m = 0; m < tab->M; m++) { + wcsprintf(" %#- 11.5g", tab->delta[m]); + } + wcsprintf("\n"); +@@ -642,20 +699,20 @@ int tabprt(const struct tabprm *tab) + WCSPRINTF_PTR(" extrema: ", tab->extrema, "\n"); dp = tab->extrema; - for (n = 0; n < tab->nc/tab->K[0]; n++) { +- for (n = 0; n < tab->nc/tab->K[0]; n++) { - /* Array index. */ +- j = n; ++ for (int n = 0; n < tab->nc/tab->K[0]; n++) { + // Array index. - j = n; ++ int j = n; cp = text; *cp = '\0'; -@@ -667,7 +664,7 @@ int tabprt(const struct tabprm *tab) +- for (m = 1; m < tab->M; m++) { +- nd = (tab->K[m] < 10) ? 1 : 2; ++ for (int m = 1; m < tab->M; m++) { ++ int nd = (tab->K[m] < 10) ? 1 : 2; + sprintf(cp, ",%*d", nd, j % tab->K[m] + 1); + j /= tab->K[m]; + cp += strlen(cp); + } + + wcsprintf(" (*,*%s)", text); +- for (m = 0; m < 2*tab->M; m++) { ++ for (int m = 0; m < 2*tab->M; m++) { + if (m == tab->M) wcsprintf("-> "); + wcsprintf(" %#- 11.5g", *(dp++)); + } +@@ -667,7 +724,7 @@ int tabprt(const struct tabprm *tab) wcserr_prt(tab->err, " "); } @@ -22186,7 +24461,16 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c wcsprintf(" m_flag: %d\n", tab->m_flag); wcsprintf(" m_M: %d\n", tab->m_M); wcsprintf(" m_N: %d\n", tab->m_N); -@@ -701,7 +698,7 @@ int tabprt(const struct tabprm *tab) +@@ -687,7 +744,7 @@ int tabprt(const struct tabprm *tab) + WCSPRINTF_PTR(" m_index: ", tab->m_index, ""); + if (tab->m_index == tab->index) wcsprintf(" (= index)"); + wcsprintf("\n"); +- for (m = 0; m < tab->M; m++) { ++ for (int m = 0; m < tab->M; m++) { + wcsprintf(" m_indxs[%d]: ", m); + WCSPRINTF_PTR("", tab->m_indxs[m], ""); + if (tab->m_indxs[m] == tab->index[m]) wcsprintf(" (= index[%d])", m); +@@ -701,7 +758,7 @@ int tabprt(const struct tabprm *tab) return 0; } @@ -22195,7 +24479,7 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c int tabperr(const struct tabprm *tab, const char *prefix) -@@ -715,7 +712,7 @@ int tabperr(const struct tabprm *tab, co +@@ -715,52 +772,49 @@ int tabperr(const struct tabprm *tab, co return 0; } @@ -22204,13 +24488,22 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c int tabset(struct tabprm *tab) -@@ -729,13 +726,13 @@ int tabset(struct tabprm *tab) + { + static const char *function = "tabset"; + +- int i, ic, k, *Km, m, M, ne; +- double *dcrd, *dmax, *dmin, dPsi, dval, *Psi; +- struct wcserr **err; +- if (tab == 0x0) return TABERR_NULL_POINTER; - err = &(tab->err); +- err = &(tab->err); ++ struct wcserr **err = &(tab->err); - /* Check the number of tabular coordinate axes. */ +- if ((M = tab->M) < 1) { + // Check the number of tabular coordinate axes. - if ((M = tab->M) < 1) { ++ int M = tab->M; ++ if (M < 1) { return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), "Invalid tabular parameters: M must be positive, got %d", M); } @@ -22220,7 +24513,14 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c if (!tab->K) { return wcserr_set(WCSERR_SET(TABERR_MEMORY), "Null pointers in tabprm struct"); -@@ -749,11 +746,11 @@ int tabset(struct tabprm *tab) + } + + tab->nc = 1; +- for (m = 0; m < M; m++) { ++ for (int m = 0; m < M; m++) { + if (tab->K[m] < 1) { + return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), + "Invalid tabular parameters: Each element of K must be positive, " "got %d", tab->K[m]); } @@ -22234,7 +24534,16 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c if (!tab->map) { return wcserr_set(WCSERR_SET(TABERR_MEMORY), "Null pointers in tabprm struct"); -@@ -768,13 +765,13 @@ int tabset(struct tabprm *tab) + } + +- for (m = 0; m < M; m++) { +- i = tab->map[m]; ++ for (int m = 0; m < M; m++) { ++ int i = tab->map[m]; + if (i < 0) { + return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), + "Invalid tabular parameters: Each element of map must be " +@@ -768,14 +822,14 @@ int tabset(struct tabprm *tab) } } @@ -22246,11 +24555,13 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c } - /* Take memory if signalled to by wcstab(). */ +- for (m = 0; m < tab->m_M; m++) { + // Take memory if signalled to by wcstab(). - for (m = 0; m < tab->m_M; m++) { ++ for (int m = 0; m < tab->m_M; m++) { if (tab->m_indxs[m] == (double *)0x1 && (tab->m_indxs[m] = tab->index[m])) { -@@ -788,15 +785,15 @@ int tabset(struct tabprm *tab) + tab->m_flag = TABSET; +@@ -788,15 +842,15 @@ int tabset(struct tabprm *tab) } @@ -22269,24 +24580,37 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c if (!(tab->sense = calloc(M, sizeof(int)))) { return wcserr_set(TAB_ERRMSG(TABERR_MEMORY)); } -@@ -823,14 +820,14 @@ int tabset(struct tabprm *tab) +@@ -812,7 +866,7 @@ int tabset(struct tabprm *tab) + return wcserr_set(TAB_ERRMSG(TABERR_MEMORY)); + } + +- ne = M * tab->nc * 2 / tab->K[0]; ++ int ne = (tab->nc / tab->K[0]) * 2 * M; + if (!(tab->extrema = calloc(ne, sizeof(double)))) { + free(tab->sense); + free(tab->p0); +@@ -823,32 +877,33 @@ int tabset(struct tabprm *tab) tab->set_M = M; } - /* Check that the index vectors are monotonic. */ +- Km = tab->K; +- for (m = 0; m < M; m++, Km++) { + // Check that the index vectors are monotonic. - Km = tab->K; - for (m = 0; m < M; m++, Km++) { ++ int *Km = tab->K; ++ for (int m = 0; m < M; m++, Km++) { tab->sense[m] = 0; if (*Km > 1) { ++ double *Psi; if ((Psi = tab->index[m]) == 0x0) { - /* Default indexing. */ + // Default indexing. tab->sense[m] = 1; } else { -@@ -838,17 +835,17 @@ int tabset(struct tabprm *tab) +- for (k = 0; k < *Km-1; k++) { ++ for (int k = 0; k < *Km-1; k++) { switch (tab->sense[m]) { case 0: if (Psi[k] < Psi[k+1]) { @@ -22307,7 +24631,7 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c free(tab->sense); free(tab->p0); free(tab->delta); -@@ -861,7 +858,7 @@ int tabset(struct tabprm *tab) +@@ -861,7 +916,7 @@ int tabset(struct tabprm *tab) case -1: if (Psi[k] < Psi[k+1]) { @@ -22316,33 +24640,68 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c free(tab->sense); free(tab->p0); free(tab->delta); -@@ -886,14 +883,14 @@ int tabset(struct tabprm *tab) +@@ -886,22 +941,23 @@ int tabset(struct tabprm *tab) } } - /* Find the extremal values of the coordinate elements in each row. */ +- dcrd = tab->coord; +- dmin = tab->extrema; +- dmax = tab->extrema + M; +- for (ic = 0; ic < tab->nc; ic += tab->K[0]) { +- for (m = 0; m < M; m++, dcrd++) { + // Find the extremal values of the coordinate elements in each row. - dcrd = tab->coord; - dmin = tab->extrema; - dmax = tab->extrema + M; - for (ic = 0; ic < tab->nc; ic += tab->K[0]) { - for (m = 0; m < M; m++, dcrd++) { ++ double *dcrd = tab->coord; ++ double *dmin = tab->extrema; ++ double *dmax = tab->extrema + M; ++ for (int ic = 0; ic < tab->nc; ic += tab->K[0]) { ++ for (int m = 0; m < M; m++, dcrd++) { if (tab->K[0] > 1) { - /* Extrapolate a little before the start of the row. */ +- Psi = tab->index[0]; + // Extrapolate a little before the start of the row. - Psi = tab->index[0]; ++ double dPsi; ++ double *Psi = tab->index[0]; if (Psi == 0x0) { dPsi = 1.0; -@@ -919,7 +916,7 @@ int tabset(struct tabprm *tab) + } else { + dPsi = Psi[1] - Psi[0]; + } + +- dval = *dcrd; ++ double dval = *dcrd; + if (dPsi != 0.0) { + dval -= 0.5 * (*(dcrd+M) - *dcrd)/dPsi; + } +@@ -913,21 +969,22 @@ int tabset(struct tabprm *tab) + } + + dcrd -= M; +- for (i = 0; i < tab->K[0]; i++) { +- for (m = 0; m < M; m++, dcrd++) { ++ for (int i = 0; i < tab->K[0]; i++) { ++ for (int m = 0; m < M; m++, dcrd++) { + if (*(dmax+m) < *dcrd) *(dmax+m) = *dcrd; if (*(dmin+m) > *dcrd) *(dmin+m) = *dcrd; if (tab->K[0] > 1 && i == tab->K[0]-1) { - /* Extrapolate a little beyond the end of the row. */ +- Psi = tab->index[0]; + // Extrapolate a little beyond the end of the row. - Psi = tab->index[0]; ++ double dPsi; ++ double *Psi = tab->index[0]; if (Psi == 0x0) { dPsi = 1.0; -@@ -947,7 +944,7 @@ int tabset(struct tabprm *tab) + } else { + dPsi = Psi[i] - Psi[i-1]; + } + +- dval = *dcrd; ++ double dval = *dcrd; + if (dPsi != 0.0) { + dval += 0.5 * (*dcrd - *(dcrd-M))/dPsi; + } +@@ -947,7 +1004,7 @@ int tabset(struct tabprm *tab) return 0; } @@ -22351,9 +24710,21 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c int tabx2s( struct tabprm *tab, -@@ -970,12 +967,12 @@ int tabx2s( +@@ -960,48 +1017,44 @@ int tabx2s( + { + static const char *function = "tabx2s"; + +- int i, iv, k, *Km, m, M, n, nv, offset, p1, status; +- double *coord, *Psi, psi_m, upsilon, wgt; +- register int *statp; +- register const double *xp; +- register double *wp; +- struct wcserr **err; ++ int status; + if (tab == 0x0) return TABERR_NULL_POINTER; - err = &(tab->err); +- err = &(tab->err); ++ struct wcserr **err = &(tab->err); - /* Initialize if required. */ + // Initialize if required. @@ -22362,24 +24733,35 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c } - /* This is used a lot. */ +- M = tab->M; + // This is used a lot. - M = tab->M; ++ int M = tab->M; status = 0; -@@ -983,25 +980,25 @@ int tabx2s( - wp = world; - statp = stat; - for (n = 0; n < ncoord; n++) { +- xp = x; +- wp = world; +- statp = stat; +- for (n = 0; n < ncoord; n++) { - /* Determine the indexes. */ -+ // Determine the indexes. - Km = tab->K; - for (m = 0; m < M; m++, Km++) { +- Km = tab->K; +- for (m = 0; m < M; m++, Km++) { - /* N.B. psi_m and Upsilon_m are 1-relative FITS indexes. */ +- i = tab->map[m]; +- psi_m = *(xp+i) + tab->crval[m]; ++ register const double *xp = x; ++ register double *wp = world; ++ register int *statp = stat; ++ for (int n = 0; n < ncoord; n++) { ++ // Determine the indexes. ++ int *Km = tab->K; ++ for (int m = 0; m < M; m++, Km++) { + // N.B. psi_m and Upsilon_m are 1-relative FITS indexes. - i = tab->map[m]; - psi_m = *(xp+i) + tab->crval[m]; ++ int i = tab->map[m]; ++ double psi_m = *(xp+i) + tab->crval[m]; - Psi = tab->index[m]; +- Psi = tab->index[m]; ++ double *Psi = tab->index[m]; ++ double upsilon; if (Psi == 0x0) { - /* Default indexing is simple. */ + // Default indexing is simple. @@ -22398,12 +24780,13 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c if (Psi[1]-0.5 <= psi_m && psi_m <= Psi[1]+0.5) { upsilon = psi_m; } else { -@@ -1011,16 +1008,16 @@ int tabx2s( +@@ -1011,16 +1064,17 @@ int tabx2s( } } else { - /* Interpolate in the indexing vector. */ + // Interpolate in the indexing vector. ++ int k; if (tab->sense[m] == 1) { - /* Monotonic increasing index values. */ + // Monotonic increasing index values. @@ -22419,7 +24802,7 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c *statp = 1; status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X)); goto next; -@@ -1028,11 +1025,11 @@ int tabx2s( +@@ -1028,11 +1082,11 @@ int tabx2s( } else if (Psi[*Km] < psi_m) { if (psi_m <= Psi[*Km] + 0.5*(Psi[*Km]-Psi[*Km-1])) { @@ -22433,7 +24816,7 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c *statp = 1; status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X)); goto next; -@@ -1053,14 +1050,14 @@ int tabx2s( +@@ -1053,14 +1107,14 @@ int tabx2s( } } else { @@ -22451,7 +24834,7 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c *statp = 1; status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X)); goto next; -@@ -1068,11 +1065,11 @@ int tabx2s( +@@ -1068,11 +1122,11 @@ int tabx2s( } else if (psi_m < Psi[*Km]) { if (Psi[*Km] - 0.5*(Psi[*Km-1]-Psi[*Km]) <= psi_m) { @@ -22465,7 +24848,7 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c *statp = 1; status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X)); goto next; -@@ -1098,41 +1095,41 @@ int tabx2s( +@@ -1098,44 +1152,44 @@ int tabx2s( } if (upsilon < 0.5 || upsilon > *Km + 0.5) { @@ -22478,9 +24861,10 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c - /* Fiducial array indices and fractional offset. - p1 is 1-relative while tab::p0 is 0-relative. */ +- p1 = (int)floor(upsilon); + // Fiducial array indices and fractional offset. + // p1 is 1-relative while tab::p0 is 0-relative. - p1 = (int)floor(upsilon); ++ int p1 = (int)floor(upsilon); tab->p0[m] = p1 - 1; tab->delta[m] = upsilon - p1; @@ -22500,32 +24884,49 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c - /* Now interpolate in the coordinate array; the M-dimensional linear */ - /* interpolation algorithm is described in Sect. 3.4 of WCS Paper IV. */ +- for (m = 0; m < M; m++) { +- i = tab->map[m]; +- *(wp+i) = 0.0; + // Now interpolate in the coordinate array; the M-dimensional linear + // interpolation algorithm is described in Sect. 3.4 of WCS Paper IV. - for (m = 0; m < M; m++) { - i = tab->map[m]; - *(wp+i) = 0.0; ++ for (int m = 0; m < M; m++) { ++ int i = tab->map[m]; ++ *(wp+i) = 0.0; } - /* Loop over the 2^M vertices surrounding P. */ -+ // Loop over the 2^M vertices surrounding P. - nv = 1 << M; - for (iv = 0; iv < nv; iv++) { +- nv = 1 << M; +- for (iv = 0; iv < nv; iv++) { - /* Locate vertex in the coordinate array and compute its weight. */ +- offset = 0; +- wgt = 1.0; +- for (m = M-1; m >= 0; m--) { ++ // Loop over the 2^M vertices surrounding P. ++ int nv = 1 << M; ++ for (int iv = 0; iv < nv; iv++) { + // Locate vertex in the coordinate array and compute its weight. - offset = 0; - wgt = 1.0; - for (m = M-1; m >= 0; m--) { -@@ -1148,7 +1145,7 @@ int tabx2s( ++ int offset = 0; ++ double wgt = 1.0; ++ for (int m = M-1; m >= 0; m--) { + offset *= tab->K[m]; + offset += tab->p0[m]; + if (iv & (1 << m)) { +@@ -1148,10 +1202,10 @@ int tabx2s( if (wgt == 0.0) continue; - /* Add the contribution from this vertex to each element. */ +- coord = tab->coord + offset*M; +- for (m = 0; m < M; m++) { +- i = tab->map[m]; + // Add the contribution from this vertex to each element. - coord = tab->coord + offset*M; - for (m = 0; m < M; m++) { - i = tab->map[m]; -@@ -1169,9 +1166,9 @@ next: ++ double *coord = tab->coord + offset*M; ++ for (int m = 0; m < M; m++) { ++ int i = tab->map[m]; + *(wp+i) += *(coord++) * wgt; + } + +@@ -1169,9 +1223,9 @@ next: return status; } @@ -22537,9 +24938,21 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c static int tabedge(struct tabprm *); static int tabrow(struct tabprm *, const double *); static int tabvox(struct tabprm *, const double *, int, double **, -@@ -1198,12 +1195,12 @@ int tabs2x( +@@ -1188,26 +1242,21 @@ int tabs2x( + { + static const char *function = "tabs2x"; + +- int edge, i, ic, iv, k, *Km, M, m, n, nv, offset, status; +- double *dcrd, delta, *Psi, psi_m, **tabcoord, upsilon; +- register int *statp; +- register const double *wp; +- register double *xp; +- struct wcserr **err; ++ int status; + if (tab == 0x0) return TABERR_NULL_POINTER; - err = &(tab->err); +- err = &(tab->err); ++ struct wcserr **err = &(tab->err); - /* Initialize if required. */ + // Initialize if required. @@ -22548,21 +24961,39 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c } - /* This is used a lot. */ +- M = tab->M; + // This is used a lot. - M = tab->M; ++ int M = tab->M; - tabcoord = 0x0; -@@ -1219,7 +1216,7 @@ int tabs2x( - xp = x; - statp = stat; - for (n = 0; n < ncoord; n++) { +- tabcoord = 0x0; +- nv = 0; ++ double **tabcoord = 0x0; ++ int nv = 0; + if (M > 1) { + nv = 1 << M; + tabcoord = calloc(nv, sizeof(double *)); +@@ -1215,59 +1264,61 @@ int tabs2x( + + + status = 0; +- wp = world; +- xp = x; +- statp = stat; +- for (n = 0; n < ncoord; n++) { - /* Locate this coordinate in the coordinate array. */ +- edge = 0; +- for (m = 0; m < M; m++) { ++ register const double *wp = world; ++ register double *xp = x; ++ register int *statp = stat; ++ for (int n = 0; n < ncoord; n++) { + // Locate this coordinate in the coordinate array. - edge = 0; - for (m = 0; m < M; m++) { ++ int edge = 0; ++ for (int m = 0; m < M; m++) { tab->p0[m] = 0; -@@ -1227,23 +1224,23 @@ int tabs2x( + } ++ int ic; for (ic = 0; ic < tab->nc; ic++) { if (tab->p0[0] == 0) { - /* New row, could it contain a solution? */ @@ -22585,11 +25016,27 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c if (M == 1) { - /* Deal with the one-dimensional case separately for efficiency. */ +- if (*wp == tab->coord[0]) { + // Deal with the one-dimensional case separately for efficiency. - if (*wp == tab->coord[0]) { ++ double w = wp[tab->map[0]]; ++ if (w == tab->coord[0]) { tab->p0[0] = 0; tab->delta[0] = 0.0; -@@ -1262,9 +1259,9 @@ int tabs2x( + break; + + } else if (ic < tab->nc - 1) { +- if (((tab->coord[ic] <= *wp && *wp <= tab->coord[ic+1]) || +- (tab->coord[ic] >= *wp && *wp >= tab->coord[ic+1])) && ++ if (((tab->coord[ic] <= w && w <= tab->coord[ic+1]) || ++ (tab->coord[ic] >= w && w >= tab->coord[ic+1])) && + (tab->index[0] == 0x0 || + tab->index[0][ic] != tab->index[0][ic+1])) { + tab->p0[0] = ic; +- tab->delta[0] = (*wp - tab->coord[ic]) / ++ tab->delta[0] = (w - tab->coord[ic]) / + (tab->coord[ic+1] - tab->coord[ic]); + break; + } } } else { @@ -22597,11 +25044,17 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c + // Multi-dimensional tables are harder. if (!edge) { - /* Addresses of the coordinates for each corner of the "voxel". */ +- for (iv = 0; iv < nv; iv++) { +- offset = 0; +- for (m = M-1; m >= 0; m--) { + // Addresses of the coordinates for each corner of the "voxel". - for (iv = 0; iv < nv; iv++) { - offset = 0; - for (m = M-1; m >= 0; m--) { -@@ -1276,12 +1273,12 @@ int tabs2x( ++ for (int iv = 0; iv < nv; iv++) { ++ int offset = 0; ++ for (int m = M-1; m >= 0; m--) { + offset *= tab->K[m]; + offset += tab->p0[m]; + if ((iv & (1 << m)) && (tab->K[m] > 1)) offset++; +@@ -1276,12 +1327,12 @@ int tabs2x( } if (tabvox(tab, wp, 0, tabcoord, 0x0) == 0) { @@ -22616,7 +25069,7 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c tab->p0[0]++; edge = tabedge(tab); } -@@ -1289,9 +1286,9 @@ int tabs2x( +@@ -1289,15 +1340,16 @@ int tabs2x( if (ic == tab->nc) { @@ -22624,11 +25077,22 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c + // Coordinate not found; allow minor extrapolation. if (M == 1) { - /* Should there be a solution? */ +- if (tab->extrema[0] <= *wp && *wp <= tab->extrema[1]) { +- dcrd = tab->coord; +- for (i = 0; i < 2; i++) { + // Should there be a solution? - if (tab->extrema[0] <= *wp && *wp <= tab->extrema[1]) { - dcrd = tab->coord; - for (i = 0; i < 2; i++) { -@@ -1317,43 +1314,43 @@ int tabs2x( ++ double w = wp[tab->map[0]]; ++ if (tab->extrema[0] <= w && w <= tab->extrema[1]) { ++ double *dcrd = tab->coord; ++ for (int i = 0; i < 2; i++) { + if (i) dcrd += tab->K[0] - 2; + +- delta = (*wp - *dcrd) / (*(dcrd+1) - *dcrd); ++ double delta = (w - *dcrd) / (*(dcrd+1) - *dcrd); + + if (i == 0) { + if (-0.5 <= delta && delta <= 0.0) { +@@ -1317,46 +1369,47 @@ int tabs2x( } } else { @@ -22648,12 +25112,15 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c } else { - /* Determine the intermediate world coordinates. */ -+ // Determine the intermediate world coordinates. - Km = tab->K; - for (m = 0; m < M; m++, Km++) { +- Km = tab->K; +- for (m = 0; m < M; m++, Km++) { - /* N.B. Upsilon_m and psi_m are 1-relative FITS indexes. */ +- upsilon = (tab->p0[m] + 1) + tab->delta[m]; ++ // Determine the intermediate world coordinates. ++ int *Km = tab->K; ++ for (int m = 0; m < M; m++, Km++) { + // N.B. Upsilon_m and psi_m are 1-relative FITS indexes. - upsilon = (tab->p0[m] + 1) + tab->delta[m]; ++ double upsilon = (tab->p0[m] + 1) + tab->delta[m]; if (upsilon < 0.5 || upsilon > *Km + 0.5) { - /* Index out of range. */ @@ -22663,8 +25130,10 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c } else { - /* Do inverse lookup of the index vector. */ +- Psi = tab->index[m]; + // Do inverse lookup of the index vector. - Psi = tab->index[m]; ++ double *Psi = tab->index[m]; ++ double psi_m; if (Psi == 0x0) { - /* Default indexing. */ + // Default indexing. @@ -22682,10 +25151,31 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c + // Degenerate index vector. psi_m = Psi[1]; } else { - k = (int)(upsilon); -@@ -1396,14 +1393,14 @@ int tabedge(struct tabprm* tab) - edge = 0; - for (m = 0; m < tab->M; m++) { +- k = (int)(upsilon); ++ int k = (int)(upsilon); + psi_m = Psi[k]; + if (k < *Km) { + psi_m += (upsilon - k) * (Psi[k+1] - Psi[k]); +@@ -1364,8 +1417,7 @@ int tabs2x( + } + } + +- i = tab->map[m]; +- xp[i] = psi_m - tab->crval[m]; ++ xp[tab->map[m]] = psi_m - tab->crval[m]; + } + } + *statp = 0; +@@ -1391,19 +1443,18 @@ int tabs2x( + int tabedge(struct tabprm* tab) + + { +- int edge, m; ++ int edge = 0; + +- edge = 0; +- for (m = 0; m < tab->M; m++) { ++ for (int m = 0; m < tab->M; m++) { if (tab->p0[m] == tab->K[m]) { - /* p0 has been incremented beyond the end of an index vector, point it - to the next one. */ @@ -22701,26 +25191,42 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c edge = 1; } } -@@ -1450,48 +1447,48 @@ int tabrow(struct tabprm* tab, const dou +@@ -1443,55 +1494,52 @@ int tabedge(struct tabprm* tab) + int tabrow(struct tabprm* tab, const double *wp) - M = tab->M; + { +- int M, m, offset; +- unsigned int eq, gt, iv, lt, nv; + const double tol = 1e-10; +- double *cp, w; + +- M = tab->M; ++ int M = tab->M; - /* The number of corners in a "voxel". We need examine only half this - number of rows. The extra factor of two will be used to select between - the minimal and maximal values in each row. */ +- nv = 1 << M; +- +- eq = 0; +- lt = 0; +- gt = 0; +- for (iv = 0; iv < nv; iv++) { +- /* Find the index into tabprm::extrema for this row. */ +- offset = 0; +- for (m = M-1; m > 0; m--) { + // The number of corners in a "voxel". We need examine only half this + // number of rows. The extra factor of two will be used to select between + // the minimal and maximal values in each row. - nv = 1 << M; - - eq = 0; - lt = 0; - gt = 0; - for (iv = 0; iv < nv; iv++) { -- /* Find the index into tabprm::extrema for this row. */ ++ unsigned int nv = 1 << M; ++ ++ unsigned int eq = 0; ++ unsigned int lt = 0; ++ unsigned int gt = 0; ++ for (unsigned int iv = 0; iv < nv; iv++) { + // Find the index into tabprm::extrema for this row. - offset = 0; - for (m = M-1; m > 0; m--) { ++ int offset = 0; ++ for (int m = M-1; m > 0; m--) { offset *= tab->K[m]; offset += tab->p0[m]; @@ -22744,28 +25250,31 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c offset *= M; - /* Address of the extremal elements (min or max) for this row. */ +- cp = tab->extrema + offset; + // Address of the extremal elements (min or max) for this row. - cp = tab->extrema + offset; ++ double *cp = tab->extrema + offset; - /* For each coordinate element, we only need to find one row where its - minimum value is less than that of wp, and one row where the maximum - value is greater. That doesn't mean that there is a solution, only - that there might be. */ +- for (m = 0; m < M; m++, cp++) { +- /* Apply the axis mapping. */ +- w = wp[tab->map[m]]; + // For each coordinate element, we only need to find one row where its + // minimum value is less than that of wp, and one row where the maximum + // value is greater. That doesn't mean that there is a solution, only + // that there might be. - for (m = 0; m < M; m++, cp++) { -- /* Apply the axis mapping. */ ++ for (int m = 0; m < M; m++, cp++) { + // Apply the axis mapping. - w = wp[tab->map[m]]; ++ double w = wp[tab->map[m]]; - /* Finally the test itself; set bits in the bitmask. */ + // Finally the test itself; set bits in the bitmask. if (fabs(*cp - w) < tol) { eq |= (1 << m); } else if (*cp < w) { -@@ -1501,14 +1498,14 @@ int tabrow(struct tabprm* tab, const dou +@@ -1501,14 +1549,14 @@ int tabrow(struct tabprm* tab, const dou } } @@ -22783,77 +25292,106 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c return 1; } -@@ -1547,7 +1544,7 @@ int tabvox( +@@ -1540,30 +1588,28 @@ int tabvox( + unsigned int *vox) - M = tab->M; + { +- int i, M, m; +- unsigned int eq, et, gt, iv, jv, lt, nv, vox2[32]; + const double tol = 1e-10; +- double coord[32], *cp, dv, w, wgt; + +- M = tab->M; ++ int M = tab->M; - /* The number of corners in a voxel. */ +- nv = 1 << M; + // The number of corners in a voxel. - nv = 1 << M; ++ unsigned int nv = 1 << M; - dv = 1.0; -@@ -1555,14 +1552,14 @@ int tabvox( +- dv = 1.0; +- for (i = 0; i < level; i++) { ++ double dv = 1.0; ++ for (int i = 0; i < level; i++) { dv /= 2.0; } - /* Could the coordinate lie within this voxel (level == 0) or sub-voxel - (level > 0)? We use the fact that with linear interpolation the - coordinate elements are extremal in a corner and test each one. */ +- lt = 0; +- gt = 0; +- eq = 0; +- for (iv = 0; iv < nv; iv++) { +- /* Select a corner of the sub-voxel. */ +- for (m = 0; m < M; m++) { + // Could the coordinate lie within this voxel (level == 0) or sub-voxel + // (level > 0)? We use the fact that with linear interpolation the + // coordinate elements are extremal in a corner and test each one. - lt = 0; - gt = 0; - eq = 0; - for (iv = 0; iv < nv; iv++) { -- /* Select a corner of the sub-voxel. */ ++ unsigned int lt = 0; ++ unsigned int gt = 0; ++ unsigned int eq = 0; ++ for (unsigned int iv = 0; iv < nv; iv++) { + // Select a corner of the sub-voxel. - for (m = 0; m < M; m++) { ++ double coord[32]; ++ for (int m = 0; m < M; m++) { coord[m] = 0.0; tab->delta[m] = level ? dv*vox[m] : 0.0; -@@ -1572,11 +1569,11 @@ int tabvox( + +@@ -1572,13 +1618,13 @@ int tabvox( } } - /* Compute the coordinates of this corner of the sub-voxel by linear - interpolation using the weighting algorithm described in Sect. 3.4 of - WCS Paper IV. */ +- for (jv = 0; jv < nv; jv++) { +- /* Find the weight for this corner of the parent voxel. */ +- wgt = 1.0; +- for (m = 0; m < M; m++) { + // Compute the coordinates of this corner of the sub-voxel by linear + // interpolation using the weighting algorithm described in Sect. 3.4 of + // WCS Paper IV. - for (jv = 0; jv < nv; jv++) { -- /* Find the weight for this corner of the parent voxel. */ ++ for (unsigned int jv = 0; jv < nv; jv++) { + // Find the weight for this corner of the parent voxel. - wgt = 1.0; - for (m = 0; m < M; m++) { ++ double wgt = 1.0; ++ for (int m = 0; m < M; m++) { if (jv & (1 << m)) { -@@ -1588,7 +1585,7 @@ int tabvox( + wgt *= tab->delta[m]; + } else { +@@ -1588,22 +1634,22 @@ int tabvox( if (wgt == 0.0) continue; - /* Add its contribution to each coordinate element. */ +- cp = tabcoord[jv]; +- for (m = 0; m < M; m++) { + // Add its contribution to each coordinate element. - cp = tabcoord[jv]; - for (m = 0; m < M; m++) { ++ double *cp = tabcoord[jv]; ++ for (int m = 0; m < M; m++) { coord[m] += *(cp++) * wgt; -@@ -1597,13 +1594,13 @@ int tabvox( + } + if (wgt == 1.0) break; } - /* Coordinate elements are minimal or maximal in a corner. */ -+ // Coordinate elements are minimal or maximal in a corner. - et = 0; - for (m = 0; m < M; m++) { +- et = 0; +- for (m = 0; m < M; m++) { - /* Apply the axis mapping. */ +- w = wp[tab->map[m]]; ++ // Coordinate elements are minimal or maximal in a corner. ++ unsigned int et = 0; ++ for (int m = 0; m < M; m++) { + // Apply the axis mapping. - w = wp[tab->map[m]]; ++ double w = wp[tab->map[m]]; - /* Finally the test itself; set bits in the bitmask. */ + // Finally the test itself; set bits in the bitmask. if (fabs(coord[m] - w) < tol) { et |= (1 << m); } else if (coord[m] < w) { -@@ -1614,20 +1611,20 @@ int tabvox( +@@ -1614,45 +1660,46 @@ int tabvox( } if (et == nv-1) { @@ -22877,21 +25415,26 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c - /* We have a solution, squeeze out the last bit of juice. */ + // We have a solution, squeeze out the last bit of juice. dv /= 2.0; - for (m = 0; m < M; m++) { +- for (m = 0; m < M; m++) { ++ for (int m = 0; m < M; m++) { tab->delta[m] = dv * (2.0*vox[m] + 1.0); -@@ -1636,9 +1633,9 @@ int tabvox( + } + return 0; } - /* Subdivide the sub-voxel and try again for each subdivision. */ -+ // Subdivide the sub-voxel and try again for each subdivision. - for (iv = 0; iv < nv; iv++) { +- for (iv = 0; iv < nv; iv++) { - /* Select the subdivision. */ +- for (m = 0; m < M; m++) { ++ // Subdivide the sub-voxel and try again for each subdivision. ++ for (unsigned int iv = 0; iv < nv; iv++) { + // Select the subdivision. - for (m = 0; m < M; m++) { ++ unsigned int vox2[32]; ++ for (int m = 0; m < M; m++) { vox2[m] = level ? 2*vox[m] : 0; if (iv & (1 << m)) { -@@ -1646,13 +1643,13 @@ int tabvox( + vox2[m]++; } } @@ -22907,16 +25450,16 @@ Index: astropy-4.2/cextern/wcslib/C/tab.c + // No solution in this sub-voxel. return 1; } -Index: astropy-4.2/cextern/wcslib/C/tab.h +Index: astropy-4.2.1/cextern/wcslib/C/tab.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/tab.h -+++ astropy-4.2/cextern/wcslib/C/tab.h +--- astropy-4.2.1.orig/cextern/wcslib/C/tab.h ++++ astropy-4.2.1/cextern/wcslib/C/tab.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -22930,15 +25473,61 @@ Index: astropy-4.2/cextern/wcslib/C/tab.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: tab.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: tab.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: tab.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * -@@ -533,65 +530,65 @@ extern "C" { +@@ -52,7 +49,8 @@ + * encapsulation. + * + * tabini(), tabmem(), tabcpy(), and tabfree() are provided to manage the +-* tabprm struct, and another, tabprt(), to print its contents. ++* tabprm struct, tabsize() computes its total size including allocated memory, ++* and tabprt() prints its contents. + * + * tabperr() prints the error message(s) (if any) stored in a tabprm struct. + * +@@ -235,6 +233,35 @@ + * 1: Null tabprm pointer passed. + * + * ++* tabsize() - Compute the size of a tabprm struct ++* ----------------------------------------------- ++* tabsize() computes the full size of a tabprm struct, including allocated ++* memory. ++* ++* Given: ++* tab const struct tabprm* ++* Tabular transformation parameters. ++* ++* If NULL, the base size of the struct and the allocated ++* size are both set to zero. ++* ++* Returned: ++* sizes int[2] The first element is the base size of the struct as ++* returned by sizeof(struct tabprm). The second element ++* is the total allocated size, in bytes, assuming that ++* the allocation was done by tabini(). This figure ++* includes memory allocated for the constituent struct, ++* tabprm::err. ++* ++* It is not an error for the struct not to have been set ++* up via tabset(), which normally results in additional ++* memory allocation. ++* ++* Function return value: ++* int Status return value: ++* 0: Success. ++* ++* + * tabprt() - Print routine for the tabprm struct + * ---------------------------------------------- + * tabprt() prints the contents of a tabprm struct using wcsprintf(). Mainly +@@ -533,65 +560,65 @@ extern "C" { extern const char *tab_errmsg[]; enum tab_errmsg_enum { @@ -23051,7 +25640,16 @@ Index: astropy-4.2/cextern/wcslib/C/tab.h #define TABLEN (sizeof(struct tabprm)/sizeof(int)) -@@ -619,7 +616,7 @@ int tabs2x(struct tabprm *tab, int ncoor +@@ -606,6 +633,8 @@ int tabcmp(int cmp, double tol, const st + + int tabfree(struct tabprm *tab); + ++int tabsize(const struct tabprm *tab, int size[2]); ++ + int tabprt(const struct tabprm *tab); + + int tabperr(const struct tabprm *tab, const char *prefix); +@@ -619,7 +648,7 @@ int tabs2x(struct tabprm *tab, int ncoor double x[], int stat[]); @@ -23060,22 +25658,22 @@ Index: astropy-4.2/cextern/wcslib/C/tab.h #define tabini_errmsg tab_errmsg #define tabcpy_errmsg tab_errmsg #define tabfree_errmsg tab_errmsg -@@ -632,4 +629,4 @@ int tabs2x(struct tabprm *tab, int ncoor +@@ -632,4 +661,4 @@ int tabs2x(struct tabprm *tab, int ncoor } #endif -#endif /* WCSLIB_TAB */ +#endif // WCSLIB_TAB -Index: astropy-4.2/cextern/wcslib/C/wcs.c +Index: astropy-4.2.1/cextern/wcslib/C/wcs.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcs.c -+++ astropy-4.2/cextern/wcslib/C/wcs.c +--- astropy-4.2.1.orig/cextern/wcslib/C/wcs.c ++++ astropy-4.2.1/cextern/wcslib/C/wcs.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -23089,7 +25687,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcs.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcs.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcs.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -23107,9 +25705,13 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c const char *wcs_errmsg[] = { "Success", "Null wcsprm pointer passed", -@@ -70,70 +67,70 @@ const char *wcs_errmsg[] = { +@@ -68,72 +65,73 @@ const char *wcs_errmsg[] = { + "Invalid world coordinate", + "No solution found in the specified interval", "Invalid subimage specification", - "Non-separable subimage coordinate system"}; +- "Non-separable subimage coordinate system"}; ++ "Non-separable subimage coordinate system", ++ "wcsprm struct is unset, use wcsset()"}; -/* Map error returns for lower-level routines. */ +// Map error returns for lower-level routines. @@ -23214,7 +25816,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c int wcsini(int alloc, int naxis, struct wcsprm *wcs) -@@ -141,7 +138,7 @@ int wcsini(int alloc, int naxis, struct +@@ -141,7 +139,7 @@ int wcsini(int alloc, int naxis, struct return wcsinit(alloc, naxis, wcs, -1, -1, -1); } @@ -23223,7 +25825,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c int wcsinit( int alloc, -@@ -158,23 +155,23 @@ int wcsinit( +@@ -158,23 +156,23 @@ int wcsinit( double *cd; struct wcserr **err; @@ -23252,7 +25854,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (wcs->flag == -1) { wcs->lin.err = 0x0; wcs->cel.err = 0x0; -@@ -185,7 +182,7 @@ int wcsinit( +@@ -185,7 +183,7 @@ int wcsinit( wcserr_clear(&(wcs->spc.err)); @@ -23261,7 +25863,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (wcs->flag == -1 || wcs->m_flag != WCSSET) { if (wcs->flag == -1) { wcs->tab = 0x0; -@@ -193,7 +190,7 @@ int wcsinit( +@@ -193,7 +191,7 @@ int wcsinit( wcs->lin.flag = -1; } @@ -23270,7 +25872,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->m_flag = 0; wcs->m_naxis = 0; wcs->m_crpix = 0x0; -@@ -223,7 +220,7 @@ int wcsinit( +@@ -223,7 +221,7 @@ int wcsinit( } @@ -23279,7 +25881,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (alloc || wcs->crpix == 0x0 || wcs->pc == 0x0 || -@@ -242,18 +239,18 @@ int wcsinit( +@@ -242,18 +240,18 @@ int wcsinit( wcs->czphs == 0x0 || wcs->cperi == 0x0) { @@ -23301,7 +25903,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->crpix = wcs->m_crpix; } else { -@@ -269,7 +266,7 @@ int wcsinit( +@@ -269,7 +267,7 @@ int wcsinit( if (alloc || wcs->pc == 0x0) { if (wcs->m_pc) { @@ -23310,7 +25912,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->pc = wcs->m_pc; } else { -@@ -286,7 +283,7 @@ int wcsinit( +@@ -286,7 +284,7 @@ int wcsinit( if (alloc || wcs->cdelt == 0x0) { if (wcs->m_cdelt) { @@ -23319,7 +25921,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->cdelt = wcs->m_cdelt; } else { -@@ -303,7 +300,7 @@ int wcsinit( +@@ -303,7 +301,7 @@ int wcsinit( if (alloc || wcs->crval == 0x0) { if (wcs->m_crval) { @@ -23328,7 +25930,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->crval = wcs->m_crval; } else { -@@ -320,7 +317,7 @@ int wcsinit( +@@ -320,7 +318,7 @@ int wcsinit( if (alloc || wcs->cunit == 0x0) { if (wcs->m_cunit) { @@ -23337,7 +25939,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->cunit = wcs->m_cunit; } else { -@@ -337,7 +334,7 @@ int wcsinit( +@@ -337,7 +335,7 @@ int wcsinit( if (alloc || wcs->ctype == 0x0) { if (wcs->m_ctype) { @@ -23346,7 +25948,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->ctype = wcs->m_ctype; } else { -@@ -354,7 +351,7 @@ int wcsinit( +@@ -354,7 +352,7 @@ int wcsinit( if (alloc || wcs->pv == 0x0) { if (wcs->m_pv) { @@ -23355,7 +25957,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->pv = wcs->m_pv; } else { -@@ -377,7 +374,7 @@ int wcsinit( +@@ -377,7 +375,7 @@ int wcsinit( if (alloc || wcs->ps == 0x0) { if (wcs->m_ps) { @@ -23364,7 +25966,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->ps = wcs->m_ps; } else { -@@ -400,7 +397,7 @@ int wcsinit( +@@ -400,7 +398,7 @@ int wcsinit( if (alloc || wcs->cd == 0x0) { if (wcs->m_cd) { @@ -23373,7 +25975,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->cd = wcs->m_cd; } else { -@@ -417,7 +414,7 @@ int wcsinit( +@@ -417,7 +415,7 @@ int wcsinit( if (alloc || wcs->crota == 0x0) { if (wcs->m_crota) { @@ -23382,7 +25984,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->crota = wcs->m_crota; } else { -@@ -434,7 +431,7 @@ int wcsinit( +@@ -434,7 +432,7 @@ int wcsinit( if (alloc || wcs->colax == 0x0) { if (wcs->m_colax) { @@ -23391,7 +25993,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->colax = wcs->m_colax; } else { -@@ -451,7 +448,7 @@ int wcsinit( +@@ -451,7 +449,7 @@ int wcsinit( if (alloc || wcs->cname == 0x0) { if (wcs->m_cname) { @@ -23400,7 +26002,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->cname = wcs->m_cname; } else { -@@ -468,7 +465,7 @@ int wcsinit( +@@ -468,7 +466,7 @@ int wcsinit( if (alloc || wcs->crder == 0x0) { if (wcs->m_crder) { @@ -23409,7 +26011,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->crder = wcs->m_crder; } else { -@@ -485,7 +482,7 @@ int wcsinit( +@@ -485,7 +483,7 @@ int wcsinit( if (alloc || wcs->csyer == 0x0) { if (wcs->m_csyer) { @@ -23418,7 +26020,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->csyer = wcs->m_csyer; } else { -@@ -502,7 +499,7 @@ int wcsinit( +@@ -502,7 +500,7 @@ int wcsinit( if (alloc || wcs->czphs == 0x0) { if (wcs->m_czphs) { @@ -23427,7 +26029,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->czphs = wcs->m_czphs; } else { -@@ -519,7 +516,7 @@ int wcsinit( +@@ -519,7 +517,7 @@ int wcsinit( if (alloc || wcs->cperi == 0x0) { if (wcs->m_cperi) { @@ -23436,7 +26038,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->cperi = wcs->m_cperi; } else { -@@ -540,7 +537,7 @@ int wcsinit( +@@ -540,7 +538,7 @@ int wcsinit( wcs->naxis = naxis; @@ -23445,7 +26047,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->lin.crpix = wcs->crpix; wcs->lin.pc = wcs->pc; wcs->lin.cdelt = wcs->cdelt; -@@ -549,28 +546,28 @@ int wcsinit( +@@ -549,28 +547,28 @@ int wcsinit( } @@ -23479,7 +26081,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->npv = 0; for (k = 0; k < wcs->npvmax; k++) { wcs->pv[k].i = 0; -@@ -585,7 +582,7 @@ int wcsinit( +@@ -585,7 +583,7 @@ int wcsinit( memset(wcs->ps[k].value, 0, 72); } @@ -23488,7 +26090,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c cd = wcs->cd; for (i = 0; i < naxis; i++) { for (j = 0; j < naxis; j++) { -@@ -598,7 +595,7 @@ int wcsinit( +@@ -598,7 +596,7 @@ int wcsinit( wcs->altlin = 0; wcs->velref = 0; @@ -23497,7 +26099,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c memset(wcs->alt, 0, 4); wcs->alt[0] = ' '; wcs->colnum = 0; -@@ -661,16 +658,16 @@ int wcsinit( +@@ -661,16 +659,16 @@ int wcsinit( memset(wcs->ssyssrc, 0, 72); wcs->velangl = UNDEFINED; @@ -23517,8 +26119,12 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c strcpy(wcs->lngtyp, " "); strcpy(wcs->lattyp, " "); wcs->lng = -1; -@@ -684,7 +681,7 @@ int wcsinit( - return 0; +@@ -681,10 +679,10 @@ int wcsinit( + celini(&(wcs->cel)); + spcini(&(wcs->spc)); + +- return 0; ++ return WCSERR_SUCCESS; } -/*--------------------------------------------------------------------------*/ @@ -23526,7 +26132,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c int wcsauxi( int alloc, -@@ -696,14 +693,14 @@ int wcsauxi( +@@ -696,14 +694,14 @@ int wcsauxi( struct auxprm *aux; struct wcserr **err; @@ -23544,8 +26150,12 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->aux = wcs->m_aux; } else { -@@ -725,7 +722,7 @@ int wcsauxi( - return 0; +@@ -722,10 +720,10 @@ int wcsauxi( + aux->hgln_obs = UNDEFINED; + aux->hglt_obs = UNDEFINED; + +- return 0; ++ return WCSERR_SUCCESS; } -/*--------------------------------------------------------------------------*/ @@ -23553,7 +26163,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c int wcssub( int alloc, -@@ -753,7 +750,7 @@ int wcssub( +@@ -753,7 +751,7 @@ int wcssub( if (wcsdst == 0x0) return WCSERR_NULL_POINTER; err = &(wcsdst->err); @@ -23562,7 +26172,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if ((naxis = wcssrc->naxis) <= 0) { return wcserr_set(WCSERR_SET(WCSERR_MEMORY), "naxis must be positive (got %d)", naxis); -@@ -766,14 +763,14 @@ int wcssub( +@@ -766,14 +764,14 @@ int wcssub( *nsub = naxis; } @@ -23579,7 +26189,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if ((axes = calloc(naxis, sizeof(int))) == 0x0) { free(itmp); return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); -@@ -784,7 +781,7 @@ int wcssub( +@@ -784,7 +782,7 @@ int wcssub( } } @@ -23588,7 +26198,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcsdst->m_aux = 0x0; wcsdst->m_tab = 0x0; -@@ -794,7 +791,7 @@ int wcssub( +@@ -794,7 +792,7 @@ int wcssub( axis = axes[j]; if (abs(axis) > 0x1000) { @@ -23597,7 +26207,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c k = abs(axis) & 0xFF; longitude = k & WCSSUB_LONGITUDE; -@@ -815,7 +812,7 @@ int wcssub( +@@ -815,7 +813,7 @@ int wcssub( strncpy (ctypei, (char *)(wcssrc->ctype + i), 8); ctypei[8] = '\0'; @@ -23606,7 +26216,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c c = ctypei + 8; while (c-- > ctypei) { if (*c == ' ') *c = '\0'; -@@ -874,7 +871,7 @@ int wcssub( +@@ -874,7 +872,7 @@ int wcssub( continue; } @@ -23615,7 +26225,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c for (k = 0; k < msub; k++) { if (itmp[k] == i+1) { break; -@@ -884,7 +881,7 @@ int wcssub( +@@ -884,7 +882,7 @@ int wcssub( } } else if (0 < axis && axis <= naxis) { @@ -23624,7 +26234,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c for (k = 0; k < msub; k++) { if (itmp[k] == axis) { break; -@@ -893,7 +890,7 @@ int wcssub( +@@ -893,7 +891,7 @@ int wcssub( if (k == msub) itmp[msub++] = axis; } else if (axis == 0) { @@ -23633,7 +26243,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c itmp[msub++] = 0; } else { -@@ -903,7 +900,7 @@ int wcssub( +@@ -903,7 +901,7 @@ int wcssub( } if ((*nsub = msub) == 0) { @@ -23642,7 +26252,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c status = wcsinit(alloc, 0, wcsdst, 0, 0, 0); goto cleanup; } -@@ -913,11 +910,11 @@ int wcssub( +@@ -913,11 +911,11 @@ int wcssub( } @@ -23659,7 +26269,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c map = itmp; for (i = 0; i < naxis; i++) { map[i] = 0; -@@ -930,8 +927,8 @@ int wcssub( +@@ -930,8 +928,8 @@ int wcssub( } @@ -23670,7 +26280,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c srcp = wcssrc->pc; for (i = 0; i < naxis; i++) { for (j = 0; j < naxis; j++) { -@@ -944,8 +941,8 @@ int wcssub( +@@ -944,8 +942,8 @@ int wcssub( } } @@ -23681,7 +26291,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c ndpmax = 0; for (m = 0; m < 2; m++) { if (m == 0) { -@@ -959,7 +956,7 @@ int wcssub( +@@ -959,7 +957,7 @@ int wcssub( for (j = 0; j < naxis; j++) { if (map[j] == 0) continue; @@ -23690,7 +26300,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c for (jhat = 0; jhat < 32; jhat++) { axmap[jhat] = -1; } -@@ -967,7 +964,7 @@ int wcssub( +@@ -967,7 +965,7 @@ int wcssub( Nhat = 0; dpsrc = dissrc->dp; for (idp = 0; idp < dissrc->ndp; idp++, dpsrc++) { @@ -23699,7 +26309,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (dpsrc->j != j+1) continue; if (dpsrc->field[1] != pq[m]) continue; if ((fp = strchr(dpsrc->field, '.')) == 0x0) continue; -@@ -994,12 +991,12 @@ int wcssub( +@@ -994,12 +992,12 @@ int wcssub( if (axmap[jhat] < 0) { axmap[jhat] = jhat; @@ -23714,7 +26324,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c status = wcserr_set(WCS_ERRMSG(WCSERR_NON_SEPARABLE)); goto cleanup; } -@@ -1011,7 +1008,7 @@ int wcssub( +@@ -1011,7 +1009,7 @@ int wcssub( } @@ -23723,7 +26333,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c npvmax = 0; for (m = 0; m < wcssrc->npv; m++) { i = wcssrc->pv[m].i; -@@ -1020,7 +1017,7 @@ int wcssub( +@@ -1020,7 +1018,7 @@ int wcssub( } } @@ -23732,7 +26342,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c npsmax = 0; for (m = 0; m < wcssrc->nps; m++) { i = wcssrc->ps[m].i; -@@ -1029,7 +1026,7 @@ int wcssub( +@@ -1029,7 +1027,7 @@ int wcssub( } } @@ -23741,7 +26351,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c status = wcsinit(alloc, *nsub, wcsdst, npvmax, npsmax, ndpmax); for (m = 0; m < 2; m++) { -@@ -1046,7 +1043,7 @@ int wcssub( +@@ -1046,7 +1044,7 @@ int wcssub( return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } @@ -23750,7 +26360,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c disdst->flag = -1; lindist(m+1, &(wcsdst->lin), disdst, ndpmax); } -@@ -1057,7 +1054,7 @@ int wcssub( +@@ -1057,7 +1055,7 @@ int wcssub( } @@ -23759,7 +26369,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c srcp = wcssrc->crpix; dstp = wcsdst->crpix; for (j = 0; j < *nsub; j++, dstp++) { -@@ -1087,7 +1084,7 @@ int wcssub( +@@ -1087,7 +1085,7 @@ int wcssub( } } @@ -23768,7 +26378,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c srcp = wcssrc->crval; dstp = wcsdst->crval; for (i = 0; i < *nsub; i++, dstp++) { -@@ -1097,7 +1094,7 @@ int wcssub( +@@ -1097,7 +1095,7 @@ int wcssub( } } @@ -23777,7 +26387,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c for (i = 0; i < *nsub; i++) { if (axes[i] > 0) { k = axes[i] - 1; -@@ -1106,18 +1103,18 @@ int wcssub( +@@ -1106,18 +1104,18 @@ int wcssub( } } @@ -23799,27 +26409,57 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcsdst->pv[npv] = wcssrc->pv[m]; wcsdst->pv[npv].i = 0; npv++; -@@ -1140,7 +1137,7 @@ int wcssub( +@@ -1140,47 +1138,51 @@ int wcssub( } wcsdst->nps = nps; - /* Alternate linear transformations. */ -+ // Alternate linear transformations. - srcp = wcssrc->cd; - dstp = wcsdst->cd; - for (i = 0; i < *nsub; i++) { -@@ -1149,8 +1146,8 @@ int wcssub( - k = (axes[i]-1)*naxis + (axes[j]-1); - *dstp = *(srcp+k); - } else if (i == j && wcssrc->altlin & 2) { +- srcp = wcssrc->cd; +- dstp = wcsdst->cd; +- for (i = 0; i < *nsub; i++) { +- for (j = 0; j < *nsub; j++, dstp++) { +- if (axes[i] > 0 && axes[j] > 0) { +- k = (axes[i]-1)*naxis + (axes[j]-1); +- *dstp = *(srcp+k); +- } else if (i == j && wcssrc->altlin & 2) { - /* A new axis is being created where CDi_ja was present in the input - header, so override the default value of 0 set by wcsinit(). */ -+ // A new axis is being created where CDi_ja was present in the input -+ // header, so override the default value of 0 set by wcsinit(). - *dstp = 1.0; +- *dstp = 1.0; ++ // Alternate linear transformations. ++ if (wcssrc->cd) { ++ srcp = wcssrc->cd; ++ dstp = wcsdst->cd; ++ for (i = 0; i < *nsub; i++) { ++ for (j = 0; j < *nsub; j++, dstp++) { ++ if (axes[i] > 0 && axes[j] > 0) { ++ k = (axes[i]-1)*naxis + (axes[j]-1); ++ *dstp = *(srcp+k); ++ } else if (i == j && wcssrc->altlin & 2) { ++ // A new axis is being created where CDi_ja was present in the input ++ // header, so override the default value of 0 set by wcsinit(). ++ *dstp = 1.0; ++ } } } -@@ -1168,7 +1165,7 @@ int wcssub( + } + +- srcp = wcssrc->crota; +- dstp = wcsdst->crota; +- for (i = 0; i < *nsub; i++, dstp++) { +- if (axes[i] > 0) { +- k = axes[i] - 1; +- *dstp = *(srcp+k); ++ if (wcssrc->crota) { ++ srcp = wcssrc->crota; ++ dstp = wcsdst->crota; ++ for (i = 0; i < *nsub; i++, dstp++) { ++ if (axes[i] > 0) { ++ k = axes[i] - 1; ++ *dstp = *(srcp+k); ++ } + } + } + wcsdst->altlin = wcssrc->altlin; wcsdst->velref = wcssrc->velref; @@ -23828,7 +26468,25 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c strncpy(wcsdst->alt, wcssrc->alt, 4); wcsdst->colnum = wcssrc->colnum; -@@ -1236,7 +1233,7 @@ int wcssub( + for (i = 0; i < *nsub; i++) { + if (axes[i] > 0) { + k = axes[i] - 1; +- wcsdst->colax[i] = wcssrc->colax[k]; +- strncpy(wcsdst->cname[i], wcssrc->cname[k], 72); +- wcsdst->crder[i] = wcssrc->crder[k]; +- wcsdst->csyer[i] = wcssrc->csyer[k]; +- wcsdst->czphs[i] = wcssrc->czphs[k]; +- wcsdst->cperi[i] = wcssrc->cperi[k]; ++ if (wcssrc->colax) wcsdst->colax[i] = wcssrc->colax[k]; ++ if (wcssrc->cname) strncpy(wcsdst->cname[i], wcssrc->cname[k], 72); ++ if (wcssrc->crder) wcsdst->crder[i] = wcssrc->crder[k]; ++ if (wcssrc->csyer) wcsdst->csyer[i] = wcssrc->csyer[k]; ++ if (wcssrc->czphs) wcsdst->czphs[i] = wcssrc->czphs[k]; ++ if (wcssrc->cperi) wcsdst->cperi[i] = wcssrc->cperi[k]; + } + } + +@@ -1236,7 +1238,7 @@ int wcssub( wcsdst->velangl = wcssrc->velangl; @@ -23837,7 +26495,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (wcssrc->aux && !wcsdst->aux) { if ((wcsdst->aux = calloc(1, sizeof(struct auxprm))) == 0x0) { status = wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); -@@ -1253,10 +1250,10 @@ int wcssub( +@@ -1253,10 +1255,10 @@ int wcssub( } @@ -23850,7 +26508,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c for (m = 0; m < wcssrc->tab[itab].M; m++) { i = wcssrc->tab[itab].map[m]; -@@ -1268,7 +1265,7 @@ int wcssub( +@@ -1268,7 +1270,7 @@ int wcssub( } if (wcsdst->ntab) { @@ -23859,7 +26517,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if ((wcsdst->tab = calloc(wcsdst->ntab, sizeof(struct tabprm))) == 0x0) { wcsdst->ntab = 0; -@@ -1297,7 +1294,7 @@ int wcssub( +@@ -1297,7 +1299,7 @@ int wcssub( } @@ -23868,7 +26526,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c for (m = 0; m < 2; m++) { if (m == 0) { dissrc = wcssrc->lin.dispre; -@@ -1310,7 +1307,7 @@ int wcssub( +@@ -1310,7 +1312,7 @@ int wcssub( if (dissrc) { disdst->naxis = *nsub; @@ -23877,7 +26535,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c for (j = 0; j < *nsub; j++) { if (axes[j] > 0) { k = axes[j] - 1; -@@ -1319,13 +1316,13 @@ int wcssub( +@@ -1319,13 +1321,13 @@ int wcssub( } } @@ -23893,7 +26551,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c for (jhat = 0; jhat < 32; jhat++) { axmap[jhat] = -1; } -@@ -1352,7 +1349,7 @@ int wcssub( +@@ -1352,7 +1354,7 @@ int wcssub( } } @@ -23902,7 +26560,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c dpsrc = dissrc->dp; for (idp = 0; idp < dissrc->ndp; idp++, dpsrc++) { if (dpsrc->j != axes[j]) continue; -@@ -1361,7 +1358,7 @@ int wcssub( +@@ -1361,7 +1363,7 @@ int wcssub( fp++; if (strncmp(fp, "AXIS.", 5) == 0) { @@ -23911,7 +26569,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c continue; } -@@ -1416,7 +1413,7 @@ cleanup: +@@ -1416,7 +1418,7 @@ cleanup: return status; } @@ -23920,7 +26578,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c int wcscompare( int cmp, -@@ -1445,7 +1442,7 @@ int wcscompare( +@@ -1445,7 +1447,7 @@ int wcscompare( naxis2 = wcs1->naxis*wcs1->naxis; if (cmp & WCSCOMPARE_CRPIX) { @@ -23929,7 +26587,34 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c } else if (cmp & WCSCOMPARE_TILING) { for (i = 0; i < naxis; ++i) { diff = wcs1->crpix[i] - wcs2->crpix[i]; -@@ -1473,7 +1470,7 @@ int wcscompare( +@@ -1454,43 +1456,43 @@ int wcscompare( + } + } + } else { +- if (!wcsutil_Eq(naxis, tol, wcs1->crpix, wcs2->crpix)) { ++ if (!wcsutil_dblEq(naxis, tol, wcs1->crpix, wcs2->crpix)) { + return 0; + } + } + +- if (!wcsutil_Eq(naxis2, tol, wcs1->pc, wcs2->pc) || +- !wcsutil_Eq(naxis, tol, wcs1->cdelt, wcs2->cdelt) || +- !wcsutil_Eq(naxis, tol, wcs1->crval, wcs2->crval) || ++ if (!wcsutil_dblEq(naxis2, tol, wcs1->pc, wcs2->pc) || ++ !wcsutil_dblEq(naxis, tol, wcs1->cdelt, wcs2->cdelt) || ++ !wcsutil_dblEq(naxis, tol, wcs1->crval, wcs2->crval) || + !wcsutil_strEq(naxis, wcs1->cunit, wcs2->cunit) || + !wcsutil_strEq(naxis, wcs1->ctype, wcs2->ctype) || +- !wcsutil_Eq(1, tol, &wcs1->lonpole, &wcs2->lonpole) || +- !wcsutil_Eq(1, tol, &wcs1->latpole, &wcs2->latpole) || +- !wcsutil_Eq(1, tol, &wcs1->restfrq, &wcs2->restfrq) || +- !wcsutil_Eq(1, tol, &wcs1->restwav, &wcs2->restwav) || ++ !wcsutil_dblEq(1, tol, &wcs1->lonpole, &wcs2->lonpole) || ++ !wcsutil_dblEq(1, tol, &wcs1->latpole, &wcs2->latpole) || ++ !wcsutil_dblEq(1, tol, &wcs1->restfrq, &wcs2->restfrq) || ++ !wcsutil_dblEq(1, tol, &wcs1->restwav, &wcs2->restwav) || + wcs1->npv != wcs2->npv || + wcs1->nps != wcs2->nps) { return 0; } @@ -23938,7 +26623,11 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c for (i = 0; i < wcs1->npv; ++i) { for (j = 0; j < wcs2->npv; ++j) { if (wcs1->pv[i].i == wcs2->pv[j].i && -@@ -1484,13 +1481,13 @@ int wcscompare( + wcs1->pv[i].m == wcs2->pv[j].m) { +- if (!wcsutil_Eq(1, tol, &wcs1->pv[i].value, &wcs2->pv[j].value)) { ++ if (!wcsutil_dblEq(1, tol, &wcs1->pv[i].value, &wcs2->pv[j].value)) { + return 0; + } break; } } @@ -23954,7 +26643,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c for (i = 0; i < wcs1->nps; ++i) { for (j = 0; j < wcs2->nps; ++j) { if (wcs1->ps[i].i == wcs2->ps[j].i && -@@ -1501,7 +1498,7 @@ int wcscompare( +@@ -1501,15 +1503,15 @@ int wcscompare( break; } } @@ -23963,16 +26652,106 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (j == wcs2->nps) { return 0; } -@@ -1565,7 +1562,7 @@ int wcscompare( + } + + if (wcs1->flag != WCSSET || wcs2->flag != WCSSET) { +- if (!wcsutil_Eq(naxis2, tol, wcs1->cd, wcs2->cd) || +- !wcsutil_Eq(naxis, tol, wcs1->crota, wcs2->crota) || ++ if (!wcsutil_dblEq(naxis2, tol, wcs1->cd, wcs2->cd) || ++ !wcsutil_dblEq(naxis, tol, wcs1->crota, wcs2->crota) || + wcs1->altlin != wcs2->altlin || + wcs1->velref != wcs2->velref) { + return 0; +@@ -1521,10 +1523,10 @@ int wcscompare( + wcs1->colnum != wcs2->colnum || + !wcsutil_intEq(naxis, wcs1->colax, wcs2->colax) || + !wcsutil_strEq(naxis, wcs1->cname, wcs2->cname) || +- !wcsutil_Eq(naxis, tol, wcs1->crder, wcs2->crder) || +- !wcsutil_Eq(naxis, tol, wcs1->csyer, wcs2->csyer) || +- !wcsutil_Eq(naxis, tol, wcs1->czphs, wcs2->czphs) || +- !wcsutil_Eq(naxis, tol, wcs1->cperi, wcs2->cperi) || ++ !wcsutil_dblEq(naxis, tol, wcs1->crder, wcs2->crder) || ++ !wcsutil_dblEq(naxis, tol, wcs1->csyer, wcs2->csyer) || ++ !wcsutil_dblEq(naxis, tol, wcs1->czphs, wcs2->czphs) || ++ !wcsutil_dblEq(naxis, tol, wcs1->cperi, wcs2->cperi) || + strncmp(wcs1->wcsname, wcs2->wcsname, 72) || + strncmp(wcs1->timesys, wcs2->timesys, 72) || + strncmp(wcs1->trefpos, wcs2->trefpos, 72) || +@@ -1532,46 +1534,46 @@ int wcscompare( + strncmp(wcs1->plephem, wcs2->plephem, 72) || + strncmp(wcs1->timeunit, wcs2->timeunit, 72) || + strncmp(wcs1->dateref, wcs2->dateref, 72) || +- !wcsutil_Eq(2, tol, wcs1->mjdref, wcs2->mjdref) || +- !wcsutil_Eq(1, tol, &wcs1->timeoffs, &wcs2->timeoffs) || ++ !wcsutil_dblEq(2, tol, wcs1->mjdref, wcs2->mjdref) || ++ !wcsutil_dblEq(1, tol, &wcs1->timeoffs, &wcs2->timeoffs) || + strncmp(wcs1->dateobs, wcs2->dateobs, 72) || + strncmp(wcs1->datebeg, wcs2->datebeg, 72) || + strncmp(wcs1->dateavg, wcs2->dateavg, 72) || + strncmp(wcs1->dateend, wcs2->dateend, 72) || +- !wcsutil_Eq(1, tol, &wcs1->mjdobs, &wcs2->mjdobs) || +- !wcsutil_Eq(1, tol, &wcs1->mjdbeg, &wcs2->mjdbeg) || +- !wcsutil_Eq(1, tol, &wcs1->mjdavg, &wcs2->mjdavg) || +- !wcsutil_Eq(1, tol, &wcs1->mjdend, &wcs2->mjdend) || +- !wcsutil_Eq(1, tol, &wcs1->jepoch, &wcs2->jepoch) || +- !wcsutil_Eq(1, tol, &wcs1->bepoch, &wcs2->bepoch) || +- !wcsutil_Eq(1, tol, &wcs1->tstart, &wcs2->tstart) || +- !wcsutil_Eq(1, tol, &wcs1->tstop, &wcs2->tstop) || +- !wcsutil_Eq(1, tol, &wcs1->xposure, &wcs2->xposure) || +- !wcsutil_Eq(1, tol, &wcs1->telapse, &wcs2->telapse) || +- !wcsutil_Eq(1, tol, &wcs1->timsyer, &wcs2->timsyer) || +- !wcsutil_Eq(1, tol, &wcs1->timrder, &wcs2->timrder) || +- !wcsutil_Eq(1, tol, &wcs1->timedel, &wcs2->timedel) || +- !wcsutil_Eq(1, tol, &wcs1->timepixr, &wcs2->timepixr) || +- !wcsutil_Eq(6, tol, wcs1->obsgeo, wcs2->obsgeo) || ++ !wcsutil_dblEq(1, tol, &wcs1->mjdobs, &wcs2->mjdobs) || ++ !wcsutil_dblEq(1, tol, &wcs1->mjdbeg, &wcs2->mjdbeg) || ++ !wcsutil_dblEq(1, tol, &wcs1->mjdavg, &wcs2->mjdavg) || ++ !wcsutil_dblEq(1, tol, &wcs1->mjdend, &wcs2->mjdend) || ++ !wcsutil_dblEq(1, tol, &wcs1->jepoch, &wcs2->jepoch) || ++ !wcsutil_dblEq(1, tol, &wcs1->bepoch, &wcs2->bepoch) || ++ !wcsutil_dblEq(1, tol, &wcs1->tstart, &wcs2->tstart) || ++ !wcsutil_dblEq(1, tol, &wcs1->tstop, &wcs2->tstop) || ++ !wcsutil_dblEq(1, tol, &wcs1->xposure, &wcs2->xposure) || ++ !wcsutil_dblEq(1, tol, &wcs1->telapse, &wcs2->telapse) || ++ !wcsutil_dblEq(1, tol, &wcs1->timsyer, &wcs2->timsyer) || ++ !wcsutil_dblEq(1, tol, &wcs1->timrder, &wcs2->timrder) || ++ !wcsutil_dblEq(1, tol, &wcs1->timedel, &wcs2->timedel) || ++ !wcsutil_dblEq(1, tol, &wcs1->timepixr, &wcs2->timepixr) || ++ !wcsutil_dblEq(6, tol, wcs1->obsgeo, wcs2->obsgeo) || + strncmp(wcs1->obsorbit, wcs2->obsorbit, 72) || + strncmp(wcs1->radesys, wcs2->radesys, 72) || +- !wcsutil_Eq(1, tol, &wcs1->equinox, &wcs2->equinox) || ++ !wcsutil_dblEq(1, tol, &wcs1->equinox, &wcs2->equinox) || + strncmp(wcs1->specsys, wcs2->specsys, 72) || + strncmp(wcs1->ssysobs, wcs2->ssysobs, 72) || +- !wcsutil_Eq(1, tol, &wcs1->velosys, &wcs2->velosys) || +- !wcsutil_Eq(1, tol, &wcs1->zsource, &wcs2->zsource) || ++ !wcsutil_dblEq(1, tol, &wcs1->velosys, &wcs2->velosys) || ++ !wcsutil_dblEq(1, tol, &wcs1->zsource, &wcs2->zsource) || + strncmp(wcs1->ssyssrc, wcs2->ssyssrc, 72) || +- !wcsutil_Eq(1, tol, &wcs1->velangl, &wcs2->velangl)) { ++ !wcsutil_dblEq(1, tol, &wcs1->velangl, &wcs2->velangl)) { return 0; } - /* Compare additional auxiliary parameters. */ + // Compare additional auxiliary parameters. if (wcs1->aux && wcs2->aux) { - if (!wcsutil_Eq(1, tol, &wcs1->aux->rsun_ref, &wcs2->aux->rsun_ref) || - !wcsutil_Eq(1, tol, &wcs1->aux->dsun_obs, &wcs2->aux->dsun_obs) || -@@ -1579,7 +1576,7 @@ int wcscompare( +- if (!wcsutil_Eq(1, tol, &wcs1->aux->rsun_ref, &wcs2->aux->rsun_ref) || +- !wcsutil_Eq(1, tol, &wcs1->aux->dsun_obs, &wcs2->aux->dsun_obs) || +- !wcsutil_Eq(1, tol, &wcs1->aux->crln_obs, &wcs2->aux->crln_obs) || +- !wcsutil_Eq(1, tol, &wcs1->aux->hgln_obs, &wcs2->aux->hgln_obs) || +- !wcsutil_Eq(1, tol, &wcs1->aux->hglt_obs, &wcs2->aux->hglt_obs)) { ++ if (!wcsutil_dblEq(1, tol, &wcs1->aux->rsun_ref, &wcs2->aux->rsun_ref) || ++ !wcsutil_dblEq(1, tol, &wcs1->aux->dsun_obs, &wcs2->aux->dsun_obs) || ++ !wcsutil_dblEq(1, tol, &wcs1->aux->crln_obs, &wcs2->aux->crln_obs) || ++ !wcsutil_dblEq(1, tol, &wcs1->aux->hgln_obs, &wcs2->aux->hgln_obs) || ++ !wcsutil_dblEq(1, tol, &wcs1->aux->hglt_obs, &wcs2->aux->hglt_obs)) { + return 0; + } + } else if (wcs1->aux || wcs2->aux) { +@@ -1579,7 +1581,7 @@ int wcscompare( } } @@ -23981,7 +26760,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (wcs1->ntab != wcs2->ntab) { return 0; } -@@ -1597,7 +1594,7 @@ int wcscompare( +@@ -1597,22 +1599,20 @@ int wcscompare( return 0; } @@ -23990,7 +26769,12 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c int wcsfree(struct wcsprm *wcs) -@@ -1610,9 +1607,9 @@ int wcsfree(struct wcsprm *wcs) + { +- int j; +- + if (wcs == 0x0) return WCSERR_NULL_POINTER; + + if (wcs->flag == -1) { wcs->lin.flag = -1; } else { @@ -24002,7 +26786,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (wcs->crpix == wcs->m_crpix) wcs->crpix = 0x0; if (wcs->pc == wcs->m_pc) wcs->pc = 0x0; if (wcs->cdelt == wcs->m_cdelt) wcs->cdelt = 0x0; -@@ -1634,7 +1631,7 @@ int wcsfree(struct wcsprm *wcs) +@@ -1634,7 +1634,7 @@ int wcsfree(struct wcsprm *wcs) if (wcs->tab == wcs->m_tab) wcs->tab = 0x0; if (wcs->wtb == wcs->m_wtb) wcs->wtb = 0x0; @@ -24011,7 +26795,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (wcs->m_crpix) free(wcs->m_crpix); if (wcs->m_pc) free(wcs->m_pc); if (wcs->m_cdelt) free(wcs->m_cdelt); -@@ -1652,10 +1649,10 @@ int wcsfree(struct wcsprm *wcs) +@@ -1652,13 +1652,13 @@ int wcsfree(struct wcsprm *wcs) if (wcs->m_czphs) free(wcs->m_czphs); if (wcs->m_cperi) free(wcs->m_cperi); @@ -24022,9 +26806,14 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c - /* Allocated unconditionally by wcstab(). */ + // Allocated unconditionally by wcstab(). if (wcs->m_tab) { - for (j = 0; j < wcs->ntab; j++) { - tabfree(wcs->m_tab + j); -@@ -1666,7 +1663,7 @@ int wcsfree(struct wcsprm *wcs) +- for (j = 0; j < wcs->ntab; j++) { +- tabfree(wcs->m_tab + j); ++ for (int itab = 0; itab < wcs->ntab; itab++) { ++ tabfree(wcs->m_tab + itab); + } + + free(wcs->m_tab); +@@ -1666,7 +1666,7 @@ int wcsfree(struct wcsprm *wcs) if (wcs->m_wtb) free(wcs->m_wtb); } @@ -24033,25 +26822,297 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (wcs->types) free(wcs->types); if (wcs->lin.crpix == wcs->m_crpix) wcs->lin.crpix = 0x0; -@@ -1713,7 +1710,7 @@ int wcsfree(struct wcsprm *wcs) - return 0; +@@ -1710,10 +1710,251 @@ int wcsfree(struct wcsprm *wcs) + celfree(&(wcs->cel)); + spcfree(&(wcs->spc)); + +- return 0; ++ return WCSERR_SUCCESS; ++} ++ ++//---------------------------------------------------------------------------- ++ ++int wcstrim(struct wcsprm *wcs) ++ ++{ ++ if (wcs == 0x0) return WCSERR_NULL_POINTER; ++ ++ if (wcs->m_flag != WCSSET) { ++ // Nothing to do. ++ return WCSERR_SUCCESS; ++ } ++ ++ if (wcs->flag != WCSSET) { ++ return WCSERR_UNSET; ++ } ++ ++ if (wcs->npv < wcs->npvmax) { ++ if (wcs->m_pv) { ++ if (wcs->npv == 0) { ++ free(wcs->m_pv); ++ wcs->pv = wcs->m_pv = 0x0; ++ } else { ++ size_t size = wcs->npv * sizeof(struct pvcard); ++ // No error if realloc() fails, it will leave the array untouched. ++ if ((wcs->pv = wcs->m_pv = realloc(wcs->m_pv, size))) { ++ wcs->npvmax = wcs->npv; ++ } ++ } ++ } ++ } ++ ++ if (wcs->nps < wcs->npsmax) { ++ if (wcs->m_ps) { ++ if (wcs->nps == 0) { ++ free(wcs->m_ps); ++ wcs->ps = wcs->m_ps = 0x0; ++ } else { ++ size_t size = wcs->nps * sizeof(struct pscard); ++ // No error if realloc() fails, it will leave the array untouched. ++ if ((wcs->ps = wcs->m_ps = realloc(wcs->m_ps, size))) { ++ wcs->npsmax = wcs->nps; ++ } ++ } ++ } ++ } ++ ++ if (!(wcs->altlin & 2)) { ++ if (wcs->m_cd) { ++ free(wcs->m_cd); ++ wcs->cd = wcs->m_cd = 0x0; ++ } ++ } ++ ++ if (!(wcs->altlin & 4)) { ++ if (wcs->m_crota) { ++ free(wcs->m_crota); ++ wcs->crota = wcs->m_crota = 0x0; ++ } ++ } ++ ++ if (wcs->colax) { ++ if (wcsutil_all_ival(wcs->naxis, 0, wcs->colax)) { ++ free(wcs->m_colax); ++ wcs->colax = wcs->m_colax = 0x0; ++ } ++ } ++ ++ if (wcs->cname) { ++ if (wcsutil_all_sval(wcs->naxis, "", wcs->cname)) { ++ free(wcs->m_cname); ++ wcs->cname = wcs->m_cname = 0x0; ++ } ++ } ++ ++ if (wcs->crder) { ++ if (wcsutil_all_dval(wcs->naxis, UNDEFINED, wcs->crder)) { ++ free(wcs->m_crder); ++ wcs->crder = wcs->m_crder = 0x0; ++ } ++ } ++ ++ if (wcs->csyer) { ++ if (wcsutil_all_dval(wcs->naxis, UNDEFINED, wcs->csyer)) { ++ free(wcs->m_csyer); ++ wcs->csyer = wcs->m_csyer = 0x0; ++ } ++ } ++ ++ if (wcs->czphs) { ++ if (wcsutil_all_dval(wcs->naxis, UNDEFINED, wcs->czphs)) { ++ free(wcs->m_czphs); ++ wcs->czphs = wcs->m_czphs = 0x0; ++ } ++ } ++ ++ if (wcs->cperi) { ++ if (wcsutil_all_dval(wcs->naxis, UNDEFINED, wcs->cperi)) { ++ free(wcs->m_cperi); ++ wcs->cperi = wcs->m_cperi = 0x0; ++ } ++ } ++ ++ return WCSERR_SUCCESS; } -/*--------------------------------------------------------------------------*/ ++//---------------------------------------------------------------------------- ++ ++int wcssize(const struct wcsprm *wcs, int sizes[2]) ++ ++{ ++ if (wcs == 0x0) { ++ sizes[0] = sizes[1] = 0; ++ return WCSERR_SUCCESS; ++ } ++ ++ // Base size, in bytes. ++ sizes[0] = sizeof(struct wcsprm); ++ ++ // Total size of allocated memory, in bytes. ++ sizes[1] = 0; ++ ++ int exsizes[2]; ++ int naxis = wcs->naxis; ++ ++ // wcsprm::crpix[]. ++ sizes[1] += naxis * sizeof(double); ++ ++ // wcsprm::pc[]. ++ sizes[1] += naxis*naxis * sizeof(double); ++ ++ // wcsprm::cdelt[]. ++ sizes[1] += naxis * sizeof(double); ++ ++ // wcsprm::crval[]. ++ sizes[1] += naxis * sizeof(double); ++ ++ // wcsprm::cunit[]. ++ if (wcs->cunit) { ++ sizes[1] += naxis * sizeof(char [72]); ++ } ++ ++ // wcsprm::ctype[]. ++ sizes[1] += naxis * sizeof(char [72]); ++ ++ // wcsprm::pv[]. ++ if (wcs->pv) { ++ sizes[1] += wcs->npvmax * sizeof(struct pvcard); ++ } ++ ++ // wcsprm::ps[]. ++ if (wcs->ps) { ++ sizes[1] += wcs->npsmax * sizeof(struct pscard); ++ } ++ ++ // wcsprm::cd[]. ++ if (wcs->cd) { ++ sizes[1] += naxis*naxis * sizeof(double); ++ } ++ ++ // wcsprm::crota[]. ++ if (wcs->crota) { ++ sizes[1] += naxis * sizeof(double); ++ } ++ ++ // wcsprm::colax[]. ++ if (wcs->colax) { ++ sizes[1] += naxis * sizeof(int); ++ } ++ ++ // wcsprm::cname[]. ++ if (wcs->cname) { ++ sizes[1] += naxis * sizeof(char [72]); ++ } ++ ++ // wcsprm::crder[]. ++ if (wcs->crder) { ++ sizes[1] += naxis * sizeof(double); ++ } ++ ++ // wcsprm::csyer[]. ++ if (wcs->csyer) { ++ sizes[1] += naxis * sizeof(double); ++ } ++ ++ // wcsprm::czphs[]. ++ if (wcs->czphs) { ++ sizes[1] += naxis * sizeof(double); ++ } ++ ++ // wcsprm::cperi[]. ++ if (wcs->cperi) { ++ sizes[1] += naxis * sizeof(double); ++ } ++ ++ // wcsprm::aux. ++ if (wcs->aux) { ++ sizes[1] += sizeof(struct auxprm); ++ } ++ ++ // wcsprm::tab. ++ for (int itab = 0; itab < wcs->ntab; itab++) { ++ tabsize(wcs->tab + itab, exsizes); ++ sizes[1] += exsizes[0] + exsizes[1]; ++ } ++ ++ // wcsprm::wtb. ++ if (wcs->wtb) { ++ sizes[1] += wcs->nwtb * sizeof(struct wtbarr); ++ } ++ ++ // wcsprm::lin. ++ linsize(&(wcs->lin), exsizes); ++ sizes[1] += exsizes[1]; ++ ++ // wcsprm::err. ++ wcserr_size(wcs->err, exsizes); ++ sizes[1] += exsizes[0] + exsizes[1]; ++ ++ return WCSERR_SUCCESS; ++} ++ ++//---------------------------------------------------------------------------- ++ ++int auxsize(const struct auxprm *aux, int sizes[2]) ++ ++{ ++ if (aux == 0x0) { ++ sizes[0] = sizes[1] = 0; ++ return WCSERR_SUCCESS; ++ } ++ ++ // Base size, in bytes. ++ sizes[0] = sizeof(struct auxprm); ++ ++ // Total size of allocated memory, in bytes. ++ sizes[1] = 0; ++ ++ return WCSERR_SUCCESS; ++} ++ ++ +//---------------------------------------------------------------------------- static void wcsprt_auxc(const char *name, const char *value) { -@@ -1755,7 +1752,7 @@ int wcsprt(const struct wcsprm *wcs) +@@ -1736,64 +1977,61 @@ static void wcsprt_auxd(const char *name + int wcsprt(const struct wcsprm *wcs) + + { +- int i, j, k; +- struct wtbarr *wtbp; +- + if (wcs == 0x0) return WCSERR_NULL_POINTER; + + if (wcs->flag != WCSSET) { + wcsprintf("The wcsprm struct is UNINITIALIZED.\n"); +- return 0; ++ return WCSERR_SUCCESS; + } + + wcsprintf(" flag: %d\n", wcs->flag); + wcsprintf(" naxis: %d\n", wcs->naxis); + WCSPRINTF_PTR(" crpix: ", wcs->crpix, "\n"); + wcsprintf(" "); +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { + wcsprintf(" %#- 11.5g", wcs->crpix[i]); } wcsprintf("\n"); - /* Linear transformation. */ +- k = 0; + // Linear transformation. - k = 0; ++ int k = 0; WCSPRINTF_PTR(" pc: ", wcs->pc, "\n"); - for (i = 0; i < wcs->naxis; i++) { -@@ -1766,7 +1763,7 @@ int wcsprt(const struct wcsprm *wcs) +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { + wcsprintf(" pc[%d][]:", i); +- for (j = 0; j < wcs->naxis; j++) { ++ for (int j = 0; j < wcs->naxis; j++) { + wcsprintf(" %#- 11.5g", wcs->pc[k++]); + } wcsprintf("\n"); } @@ -24059,8 +27120,9 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c + // Coordinate increment at reference point. WCSPRINTF_PTR(" cdelt: ", wcs->cdelt, "\n"); wcsprintf(" "); - for (i = 0; i < wcs->naxis; i++) { -@@ -1774,7 +1771,7 @@ int wcsprt(const struct wcsprm *wcs) +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { + wcsprintf(" %#- 11.5g", wcs->cdelt[i]); } wcsprintf("\n"); @@ -24068,17 +27130,23 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c + // Coordinate value at reference point. WCSPRINTF_PTR(" crval: ", wcs->crval, "\n"); wcsprintf(" "); - for (i = 0; i < wcs->naxis; i++) { -@@ -1782,7 +1779,7 @@ int wcsprt(const struct wcsprm *wcs) +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { + wcsprintf(" %#- 11.5g", wcs->crval[i]); } wcsprintf("\n"); - /* Coordinate units and type. */ + // Coordinate units and type. WCSPRINTF_PTR(" cunit: ", wcs->cunit, "\n"); - for (i = 0; i < wcs->naxis; i++) { +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { wcsprintf(" \"%s\"\n", wcs->cunit[i]); -@@ -1793,7 +1790,7 @@ int wcsprt(const struct wcsprm *wcs) + } + + WCSPRINTF_PTR(" ctype: ", wcs->ctype, "\n"); +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { wcsprintf(" \"%s\"\n", wcs->ctype[i]); } @@ -24087,7 +27155,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (undefined(wcs->lonpole)) { wcsprintf(" lonpole: UNDEFINED\n"); } else { -@@ -1803,7 +1800,7 @@ int wcsprt(const struct wcsprm *wcs) +@@ -1803,29 +2041,29 @@ int wcsprt(const struct wcsprm *wcs) wcsprintf(" restfrq: %f\n", wcs->restfrq); wcsprintf(" restwav: %f\n", wcs->restwav); @@ -24096,8 +27164,22 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcsprintf(" npv: %d\n", wcs->npv); wcsprintf(" npvmax: %d\n", wcs->npvmax); WCSPRINTF_PTR(" pv: ", wcs->pv, "\n"); -@@ -1819,7 +1816,7 @@ int wcsprt(const struct wcsprm *wcs) - (wcs->ps[i]).m, (wcs->ps[i]).value); +- for (i = 0; i < wcs->npv; i++) { +- wcsprintf(" %3d%4d %#- 11.5g\n", (wcs->pv[i]).i, +- (wcs->pv[i]).m, (wcs->pv[i]).value); ++ for (int k = 0; k < wcs->npv; k++) { ++ wcsprintf(" %3d%4d %#- 11.5g\n", (wcs->pv[k]).i, ++ (wcs->pv[k]).m, (wcs->pv[k]).value); + } + wcsprintf(" nps: %d\n", wcs->nps); + wcsprintf(" npsmax: %d\n", wcs->npsmax); + WCSPRINTF_PTR(" ps: ", wcs->ps, "\n"); +- for (i = 0; i < wcs->nps; i++) { +- wcsprintf(" %3d%4d %s\n", (wcs->ps[i]).i, +- (wcs->ps[i]).m, (wcs->ps[i]).value); ++ for (int k = 0; k < wcs->nps; k++) { ++ wcsprintf(" %3d%4d %s\n", (wcs->ps[k]).i, ++ (wcs->ps[k]).m, (wcs->ps[k]).value); } - /* Alternate linear transformations. */ @@ -24105,7 +27187,24 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c k = 0; WCSPRINTF_PTR(" cd: ", wcs->cd, "\n"); if (wcs->cd) { -@@ -1846,7 +1843,7 @@ int wcsprt(const struct wcsprm *wcs) +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { + wcsprintf(" cd[%d][]:", i); +- for (j = 0; j < wcs->naxis; j++) { ++ for (int j = 0; j < wcs->naxis; j++) { + wcsprintf(" %#- 11.5g", wcs->cd[k++]); + } + wcsprintf("\n"); +@@ -1835,7 +2073,7 @@ int wcsprt(const struct wcsprm *wcs) + WCSPRINTF_PTR(" crota: ", wcs->crota, "\n"); + if (wcs->crota) { + wcsprintf(" "); +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { + wcsprintf(" %#- 11.5g", wcs->crota[i]); + } + wcsprintf("\n"); +@@ -1846,14 +2084,14 @@ int wcsprt(const struct wcsprm *wcs) @@ -24114,7 +27213,101 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcsprintf(" alt: '%c'\n", wcs->alt[0]); wcsprintf(" colnum: %d\n", wcs->colnum); -@@ -1990,7 +1987,7 @@ int wcsprt(const struct wcsprm *wcs) + WCSPRINTF_PTR(" colax: ", wcs->colax, "\n"); + if (wcs->colax) { + wcsprintf(" "); +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { + wcsprintf(" %5d", wcs->colax[i]); + } + wcsprintf("\n"); +@@ -1861,7 +2099,7 @@ int wcsprt(const struct wcsprm *wcs) + + WCSPRINTF_PTR(" cname: ", wcs->cname, "\n"); + if (wcs->cname) { +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { + if (wcs->cname[i][0] == '\0') { + wcsprintf(" UNDEFINED\n"); + } else { +@@ -1873,7 +2111,7 @@ int wcsprt(const struct wcsprm *wcs) + WCSPRINTF_PTR(" crder: ", wcs->crder, "\n"); + if (wcs->crder) { + wcsprintf(" "); +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { + if (undefined(wcs->crder[i])) { + wcsprintf(" UNDEFINED"); + } else { +@@ -1886,7 +2124,7 @@ int wcsprt(const struct wcsprm *wcs) + WCSPRINTF_PTR(" csyer: ", wcs->csyer, "\n"); + if (wcs->csyer) { + wcsprintf(" "); +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { + if (undefined(wcs->csyer[i])) { + wcsprintf(" UNDEFINED"); + } else { +@@ -1899,7 +2137,7 @@ int wcsprt(const struct wcsprm *wcs) + WCSPRINTF_PTR(" czphs: ", wcs->czphs, "\n"); + if (wcs->czphs) { + wcsprintf(" "); +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { + if (undefined(wcs->czphs[i])) { + wcsprintf(" UNDEFINED"); + } else { +@@ -1912,7 +2150,7 @@ int wcsprt(const struct wcsprm *wcs) + WCSPRINTF_PTR(" cperi: ", wcs->cperi, "\n"); + if (wcs->cperi) { + wcsprintf(" "); +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { + if (undefined(wcs->cperi[i])) { + wcsprintf(" UNDEFINED"); + } else { +@@ -1931,11 +2169,11 @@ int wcsprt(const struct wcsprm *wcs) + wcsprt_auxc("timeunit", wcs->timeunit); + wcsprt_auxc(" dateref", wcs->dateref); + wcsprintf(" mjdref: "); +- for (i = 0; i < 2; i++) { +- if (undefined(wcs->mjdref[i])) { ++ for (int k = 0; k < 2; k++) { ++ if (undefined(wcs->mjdref[k])) { + wcsprintf(" UNDEFINED"); + } else { +- wcsprintf(" %15.9f", wcs->mjdref[i]); ++ wcsprintf(" %15.9f", wcs->mjdref[k]); + } + } + wcsprintf("\n"); +@@ -1963,19 +2201,19 @@ int wcsprt(const struct wcsprm *wcs) + wcsprt_auxd("timepixr", wcs->timepixr); + + wcsprintf(" obsgeo: "); +- for (i = 0; i < 3; i++) { +- if (undefined(wcs->obsgeo[i])) { ++ for (int k = 0; k < 3; k++) { ++ if (undefined(wcs->obsgeo[k])) { + wcsprintf(" UNDEFINED"); + } else { +- wcsprintf(" %15.6f", wcs->obsgeo[i]); ++ wcsprintf(" %15.6f", wcs->obsgeo[k]); + } + } + wcsprintf("\n "); +- for (i = 3; i < 6; i++) { +- if (undefined(wcs->obsgeo[i])) { ++ for (int k = 3; k < 6; k++) { ++ if (undefined(wcs->obsgeo[k])) { + wcsprintf(" UNDEFINED"); + } else { +- wcsprintf(" %15.6f", wcs->obsgeo[i]); ++ wcsprintf(" %15.6f", wcs->obsgeo[k]); + } + } + wcsprintf("\n"); +@@ -1990,7 +2228,7 @@ int wcsprt(const struct wcsprm *wcs) wcsprt_auxc(" ssyssrc", wcs->ssyssrc); wcsprt_auxd(" velangl", wcs->velangl); @@ -24123,16 +27316,19 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c WCSPRINTF_PTR(" aux: ", wcs->aux, "\n"); if (wcs->aux) { wcsprt_auxd("rsun_ref", wcs->aux->rsun_ref); -@@ -2009,7 +2006,7 @@ int wcsprt(const struct wcsprm *wcs) +@@ -2009,9 +2247,9 @@ int wcsprt(const struct wcsprm *wcs) if (wcs->wtb != 0x0) wcsprintf(" (see below)"); wcsprintf("\n"); - /* Derived values. */ + // Derived values. WCSPRINTF_PTR(" types: ", wcs->types, "\n "); - for (i = 0; i < wcs->naxis; i++) { +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { wcsprintf("%5d", wcs->types[i]); -@@ -2032,7 +2029,7 @@ int wcsprt(const struct wcsprm *wcs) + } + wcsprintf("\n"); +@@ -2032,7 +2270,7 @@ int wcsprt(const struct wcsprm *wcs) wcsprintf(" cel: (see below)\n"); wcsprintf(" spc: (see below)\n"); @@ -24141,16 +27337,34 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcsprintf(" m_flag: %d\n", wcs->m_flag); wcsprintf(" m_naxis: %d\n", wcs->m_naxis); WCSPRINTF_PTR(" m_crpix: ", wcs->m_crpix, ""); -@@ -2094,7 +2091,7 @@ int wcsprt(const struct wcsprm *wcs) +@@ -2094,11 +2332,12 @@ int wcsprt(const struct wcsprm *wcs) if (wcs->m_wtb == wcs->wtb) wcsprintf(" (= wtb)"); wcsprintf("\n"); - /* Tabular transformation parameters. */ +- if ((wtbp = wcs->wtb)) { +- for (j = 0; j < wcs->nwtb; j++, wtbp++) { + // Tabular transformation parameters. - if ((wtbp = wcs->wtb)) { - for (j = 0; j < wcs->nwtb; j++, wtbp++) { ++ struct wtbarr *wtbp = wcs->wtb; ++ if (wtbp) { ++ for (int iwtb = 0; iwtb < wcs->nwtb; iwtb++, wtbp++) { wcsprintf("\n"); -@@ -2122,17 +2119,17 @@ int wcsprt(const struct wcsprm *wcs) +- wcsprintf("wtb[%d].*\n", j); ++ wcsprintf("wtb[%d].*\n", iwtb); + wcsprintf(" i: %d\n", wtbp->i); + wcsprintf(" m: %d\n", wtbp->m); + wcsprintf(" kind: %c\n", wtbp->kind); +@@ -2115,38 +2354,36 @@ int wcsprt(const struct wcsprm *wcs) + } + + if (wcs->tab) { +- for (j = 0; j < wcs->ntab; j++) { ++ for (int itab = 0; itab < wcs->ntab; itab++) { + wcsprintf("\n"); +- wcsprintf("tab[%d].*\n", j); +- tabprt(wcs->tab + j); ++ wcsprintf("tab[%d].*\n", itab); ++ tabprt(wcs->tab + itab); } } @@ -24171,8 +27385,9 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcsprintf("\n"); wcsprintf(" spc.*\n"); spcprt(&(wcs->spc)); -@@ -2140,7 +2137,7 @@ int wcsprt(const struct wcsprm *wcs) - return 0; + +- return 0; ++ return WCSERR_SUCCESS; } -/*--------------------------------------------------------------------------*/ @@ -24180,8 +27395,26 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c int wcsperr(const struct wcsprm *wcs, const char *prefix) -@@ -2163,7 +2160,7 @@ int wcsperr(const struct wcsprm *wcs, co - return 0; + { +- int j; +- + if (wcs == 0x0) return WCSERR_NULL_POINTER; + + if (wcs->err && wcserr_prt(wcs->err, prefix) == 0) { +@@ -2154,113 +2391,105 @@ int wcsperr(const struct wcsprm *wcs, co + celperr(&(wcs->cel), prefix); + wcserr_prt(wcs->spc.err, prefix); + if (wcs->tab) { +- for (j = 0; j < wcs->ntab; j++) { +- wcserr_prt((wcs->tab + j)->err, prefix); ++ for (int itab = 0; itab < wcs->ntab; itab++) { ++ wcserr_prt((wcs->tab + itab)->err, prefix); + } + } + } + +- return 0; ++ return WCSERR_SUCCESS; } -/*--------------------------------------------------------------------------*/ @@ -24189,8 +27422,20 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c int wcsbchk(struct wcsprm *wcs, int bounds) -@@ -2181,7 +2178,7 @@ int wcsbchk(struct wcsprm *wcs, int boun - return 0; + { +- int status; +- + if (wcs == 0x0) return WCSERR_NULL_POINTER; + + if (wcs->flag != WCSSET) { ++ int status; + if ((status = wcsset(wcs))) return status; + } + + wcs->cel.prj.bounds = bounds; + +- return 0; ++ return WCSERR_SUCCESS; } -/*--------------------------------------------------------------------------*/ @@ -24198,12 +27443,29 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c int wcsset(struct wcsprm *wcs) -@@ -2204,12 +2201,12 @@ int wcsset(struct wcsprm *wcs) + { + static const char *function = "wcsset"; + +- char dpq[16], scode[4], stype[5]; +- int i, j, k, m, n, naxis, ndpmax, status; +- double lambda, rho; +- double *cd, *pc; +- struct disprm *dis; +- struct dpkey *keyp; +- struct linprm *wcslin = &(wcs->lin); +- struct celprm *wcscel = &(wcs->cel); +- struct prjprm *wcsprj = &(wcscel->prj); +- struct spcprm *wcsspc = &(wcs->spc); +- struct wcserr **err; +- +- if (wcs == 0x0) return WCSERR_NULL_POINTER; - err = &(wcs->err); +- err = &(wcs->err); ++ struct wcserr **err = &(wcs->err); - /* Determine axis types from CTYPEia. */ + // Determine axis types from CTYPEia. ++ int status; if ((status = wcs_types(wcs))) { return status; } @@ -24213,13 +27475,19 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if ((status = wcs_units(wcs))) { return status; } -@@ -2221,45 +2218,45 @@ int wcsset(struct wcsprm *wcs) + +- naxis = wcs->naxis; ++ int naxis = wcs->naxis; + if (32 < naxis) { + return wcserr_set(WCSERR_SET(WCSERR_BAD_PARAM), + "naxis must not exceed 32 (got %d)", naxis); } - /* Non-linear celestial axes present? */ + // Non-linear celestial axes present? if (wcs->lng >= 0 && wcs->types[wcs->lng] == 2200) { ++ struct celprm *wcscel = &(wcs->cel); celini(wcscel); - /* CRVALia, LONPOLEa, and LATPOLEa keyvalues. */ @@ -24231,20 +27499,25 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c - /* Do alias translation for TPU/TPV before dealing with PVi_ma. */ + // Do alias translation for TPU/TPV before dealing with PVi_ma. ++ struct prjprm *wcsprj = &(wcscel->prj); strncpy(wcsprj->code, wcs->ctype[wcs->lng]+5, 3); wcsprj->code[3] = '\0'; if (strncmp(wcsprj->code, "TPU", 3) == 0 || strncmp(wcsprj->code, "TPV", 3) == 0) { - /* Translate the PV parameters. */ + // Translate the PV parameters. ++ struct disprm *dis; if ((dis = calloc(1, sizeof(struct disprm))) == 0x0) { return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } - ndpmax = 6 + wcs->npv; +- ndpmax = 6 + wcs->npv; ++ int ndpmax = 6 + wcs->npv; - /* Attach it to linprm. Also inits it. */ + // Attach it to linprm. Also inits it. ++ char dpq[16]; ++ struct linprm *wcslin = &(wcs->lin); dis->flag = -1; if (strncmp(wcsprj->code, "TPU", 3) == 0) { - /* Prior distortion. */ @@ -24264,20 +27537,23 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c strcpy(dis->dtype[wcs->lat], "TPV"); - /* Keep the keywords in axis-order to aid debugging. */ +- keyp = dis->dp; + // Keep the keywords in axis-order to aid debugging. - keyp = dis->dp; ++ struct dpkey *keyp = dis->dp; dis->ndp = 0; -@@ -2269,7 +2266,7 @@ int wcsset(struct wcsprm *wcs) + sprintf(dpq+2, "%d", wcs->lng+1); +@@ -2269,32 +2498,32 @@ int wcsset(struct wcsprm *wcs) dpfill(keyp++, dpq, "AXIS.2", 0, 0, 2, 0.0); dis->ndp += 3; - /* Copy distortion parameters for the longitude axis. */ +- for (k = 0; k < wcs->npv; k++) { + // Copy distortion parameters for the longitude axis. - for (k = 0; k < wcs->npv; k++) { ++ for (int k = 0; k < wcs->npv; k++) { if (wcs->pv[k].i != wcs->lng+1) continue; sprintf(keyp->field, "%s.TPV.%d", dpq, wcs->pv[k].m); -@@ -2277,7 +2274,7 @@ int wcsset(struct wcsprm *wcs) + dpfill(keyp++, 0x0, 0x0, 0, 1, 0, wcs->pv[k].value); dis->ndp++; } @@ -24286,16 +27562,29 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c sprintf(dpq+2, "%d", wcs->lat+1); dpfill(keyp++, dpq, "NAXES", 0, 0, 2, 0.0); dpfill(keyp++, dpq, "AXIS.1", 0, 0, 2, 0.0); -@@ -2291,7 +2288,7 @@ int wcsset(struct wcsprm *wcs) + dpfill(keyp++, dpq, "AXIS.2", 0, 0, 1, 0.0); + dis->ndp += 3; + +- for (k = 0; k < wcs->npv; k++) { ++ for (int k = 0; k < wcs->npv; k++) { + if (wcs->pv[k].i != wcs->lat+1) continue; + sprintf(keyp->field, "%s.TPV.%d", dpq, wcs->pv[k].m); + dpfill(keyp++, 0x0, 0x0, 0, 1, 0, wcs->pv[k].value); dis->ndp++; } - /* Erase PVi_ma associated with the celestial axes. */ +- n = 0; +- for (k = 0; k < wcs->npv; k++) { +- i = wcs->pv[k].i - 1; + // Erase PVi_ma associated with the celestial axes. - n = 0; - for (k = 0; k < wcs->npv; k++) { - i = wcs->pv[k].i - 1; -@@ -2307,28 +2304,28 @@ int wcsset(struct wcsprm *wcs) ++ int n = 0; ++ for (int k = 0; k < wcs->npv; k++) { ++ int i = wcs->pv[k].i - 1; + if (i == wcs->lng || i == wcs->lat) continue; + + wcs->pv[n].i = wcs->pv[k].i; +@@ -2307,42 +2536,42 @@ int wcsset(struct wcsprm *wcs) wcs->npv = n; strcpy(wcsprj->code, "TAN"); @@ -24322,16 +27611,19 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c } - /* PVi_ma keyvalues. */ +- for (k = 0; k < wcs->npv; k++) { + // PVi_ma keyvalues. - for (k = 0; k < wcs->npv; k++) { ++ for (int k = 0; k < wcs->npv; k++) { if (wcs->pv[k].i == 0) { - /* From a PROJPn keyword. */ + // From a PROJPn keyword. wcs->pv[k].i = wcs->lat + 1; } -@@ -2336,13 +2333,13 @@ int wcsset(struct wcsprm *wcs) - m = wcs->pv[k].m; +- i = wcs->pv[k].i - 1; +- m = wcs->pv[k].m; ++ int i = wcs->pv[k].i - 1; ++ int m = wcs->pv[k].m; if (i == wcs->lat) { - /* PVi_ma associated with latitude axis. */ @@ -24346,7 +27638,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c switch (m) { case 0: wcscel->offset = (wcs->pv[k].value != 0.0); -@@ -2354,11 +2351,11 @@ int wcsset(struct wcsprm *wcs) +@@ -2354,11 +2583,11 @@ int wcsset(struct wcsprm *wcs) wcscel->theta0 = wcs->pv[k].value; break; case 3: @@ -24360,7 +27652,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcscel->ref[3] = wcs->pv[k].value; break; default: -@@ -2370,7 +2367,7 @@ int wcsset(struct wcsprm *wcs) +@@ -2370,7 +2599,7 @@ int wcsset(struct wcsprm *wcs) } } @@ -24369,7 +27661,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (strncmp(wcs->ctype[wcs->lng]+5, "GLS", 3) == 0) { wcscel->offset = 1; wcscel->phi0 = 0.0; -@@ -2378,7 +2375,7 @@ int wcsset(struct wcsprm *wcs) +@@ -2378,7 +2607,7 @@ int wcsset(struct wcsprm *wcs) strcpy(wcsprj->code, "SFL"); } else if (strncmp(wcs->ctype[wcs->lng]+5, "NCP", 3) == 0) { @@ -24378,7 +27670,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (wcscel->ref[1] == 0.0) { return wcserr_set(WCSERR_SET(WCSERR_BAD_PARAM), "Invalid projection: NCP blows up on the equator"); -@@ -2389,13 +2386,13 @@ int wcsset(struct wcsprm *wcs) +@@ -2389,19 +2618,19 @@ int wcsset(struct wcsprm *wcs) wcsprj->pv[2] = cosd(wcscel->ref[1])/sind(wcscel->ref[1]); } @@ -24394,16 +27686,28 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->lonpole = wcscel->ref[2]; wcs->latpole = wcscel->ref[3]; -@@ -2423,7 +2420,7 @@ int wcsset(struct wcsprm *wcs) +- for (k = 0; k < wcs->npv; k++) { +- i = wcs->pv[k].i - 1; +- m = wcs->pv[k].m; ++ for (int k = 0; k < wcs->npv; k++) { ++ int i = wcs->pv[k].i - 1; ++ int m = wcs->pv[k].m; + + if (i == wcs->lng) { + switch (m) { +@@ -2423,8 +2652,10 @@ int wcsset(struct wcsprm *wcs) } - /* Non-linear spectral axis present? */ + // Non-linear spectral axis present? if (wcs->spec >= 0 && wcs->types[wcs->spec] == 3300) { ++ char scode[4], stype[5]; ++ struct spcprm *wcsspc = &(wcs->spc); spcini(wcsspc); if ((status = spctype(wcs->ctype[wcs->spec], stype, scode, 0x0, 0x0, 0x0, -@@ -2433,32 +2430,32 @@ int wcsset(struct wcsprm *wcs) + 0x0, 0x0, err))) { +@@ -2433,64 +2664,65 @@ int wcsset(struct wcsprm *wcs) strcpy(wcsspc->type, stype); strcpy(wcsspc->code, scode); @@ -24414,10 +27718,13 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcsspc->restwav = wcs->restwav; - /* PVi_ma keyvalues. */ +- for (k = 0; k < wcs->npv; k++) { +- i = wcs->pv[k].i - 1; +- m = wcs->pv[k].m; + // PVi_ma keyvalues. - for (k = 0; k < wcs->npv; k++) { - i = wcs->pv[k].i - 1; - m = wcs->pv[k].m; ++ for (int k = 0; k < wcs->npv; k++) { ++ int i = wcs->pv[k].i - 1; ++ int m = wcs->pv[k].m; if (i == wcs->spec) { - /* PVi_ma associated with grism axis. */ @@ -24437,36 +27744,57 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c - /* Tabular axes present? */ +- for (j = 0; j < wcs->ntab; j++) { +- if ((status = tabset(wcs->tab + j))) { + // Tabular axes present? - for (j = 0; j < wcs->ntab; j++) { - if ((status = tabset(wcs->tab + j))) { ++ for (int itab = 0; itab < wcs->ntab; itab++) { ++ if ((status = tabset(wcs->tab + itab))) { return wcserr_set(WCS_ERRMSG(wcs_taberr[status])); -@@ -2466,13 +2463,13 @@ int wcsset(struct wcsprm *wcs) + } } - /* Initialize the linear transformation. */ +- wcs->altlin &= 7; + // Initialize the linear transformation. - wcs->altlin &= 7; ++ wcs->altlin &= 15; if (wcs->altlin > 1 && !(wcs->altlin & 1)) { - pc = wcs->pc; +- pc = wcs->pc; ++ double *pc = wcs->pc; - if (wcs->altlin & 2) { +- if (wcs->altlin & 2) { - /* Copy CDi_ja to PCi_ja and reset CDELTia. */ +- cd = wcs->cd; +- for (i = 0; i < naxis; i++) { +- for (j = 0; j < naxis; j++) { ++ if ((wcs->altlin & 2) && !(wcs->altlin & 8)) { + // Copy CDi_ja to PCi_ja and reset CDELTia. - cd = wcs->cd; - for (i = 0; i < naxis; i++) { - for (j = 0; j < naxis; j++) { -@@ -2482,7 +2479,7 @@ int wcsset(struct wcsprm *wcs) ++ double *cd = wcs->cd; ++ for (int i = 0; i < naxis; i++) { ++ for (int j = 0; j < naxis; j++) { + *(pc++) = *(cd++); + } + wcs->cdelt[i] = 1.0; } } else if (wcs->altlin & 4) { - /* Construct PCi_ja from CROTAia. */ + // Construct PCi_ja from CROTAia. ++ int i, j; if ((i = wcs->lng) >= 0 && (j = wcs->lat) >= 0) { - rho = wcs->crota[j]; +- rho = wcs->crota[j]; ++ double rho = wcs->crota[j]; -@@ -2508,7 +2505,7 @@ int wcsset(struct wcsprm *wcs) + if (wcs->cdelt[i] == 0.0) { + return wcserr_set(WCSERR_SET(WCSERR_SINGULAR_MTX), + "Singular transformation matrix, CDELT%d is zero", i+1); + } +- lambda = wcs->cdelt[j]/wcs->cdelt[i]; ++ double lambda = wcs->cdelt[j]/wcs->cdelt[i]; + + *(pc + i*naxis + i) = *(pc + j*naxis + j) = cosd(rho); + *(pc + i*naxis + j) = *(pc + j*naxis + i) = sind(rho); +@@ -2508,7 +2740,7 @@ int wcsset(struct wcsprm *wcs) } @@ -24475,7 +27803,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (strcmp(wcs->lngtyp, "RA") == 0 || strcmp(wcs->lngtyp, "ELON") == 0 || strcmp(wcs->lngtyp, "HLON") == 0) { -@@ -2523,7 +2520,7 @@ int wcsset(struct wcsprm *wcs) +@@ -2523,7 +2755,7 @@ int wcsset(struct wcsprm *wcs) } else if (strcmp(wcs->radesys, "ICRS") == 0 || strcmp(wcs->radesys, "GAPPT") == 0) { @@ -24484,7 +27812,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->equinox = UNDEFINED; } else if (undefined(wcs->equinox)) { -@@ -2536,13 +2533,13 @@ int wcsset(struct wcsprm *wcs) +@@ -2536,17 +2768,17 @@ int wcsset(struct wcsprm *wcs) } } else { @@ -24500,7 +27828,12 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (wcs->alt[0] == '\0') wcs->alt[0] = ' '; memset(wcs->alt+1, '\0', 3); -@@ -2566,7 +2563,7 @@ int wcsset(struct wcsprm *wcs) +- for (i = 0; i < naxis; i++) { ++ for (int i = 0; i < naxis; i++) { + wcsutil_null_fill(72, wcs->cname[i]); + } + wcsutil_null_fill(72, wcs->wcsname); +@@ -2566,7 +2798,7 @@ int wcsset(struct wcsprm *wcs) wcsutil_null_fill(72, wcs->ssysobs); wcsutil_null_fill(72, wcs->ssyssrc); @@ -24509,8 +27842,12 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (wcs->dateref[0] == '\0') { if (undefined(wcs->mjdref[0])) { wcs->mjdref[0] = 0.0; -@@ -2581,7 +2578,7 @@ int wcsset(struct wcsprm *wcs) - return 0; +@@ -2578,10 +2810,10 @@ int wcsset(struct wcsprm *wcs) + + wcs->flag = WCSSET; + +- return 0; ++ return WCSERR_SUCCESS; } -/* : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : */ @@ -24518,16 +27855,22 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c int wcs_types(struct wcsprm *wcs) -@@ -2599,7 +2596,7 @@ int wcs_types(struct wcsprm *wcs) +@@ -2594,12 +2826,11 @@ int wcs_types(struct wcsprm *wcs) + const char *alt = ""; + char ctypei[16], pcode[4], requir[16], scode[4], specsys[9]; + int i, j, m, naxis, *ndx = 0x0, type; +- struct wcserr **err; + if (wcs == 0x0) return WCSERR_NULL_POINTER; - err = &(wcs->err); +- err = &(wcs->err); ++ struct wcserr **err = &(wcs->err); - /* Parse the CTYPEia keyvalues. */ + // Parse the CTYPEia keyvalues. pcode[0] = '\0'; requir[0] = '\0'; wcs->lng = -1; -@@ -2617,63 +2614,63 @@ int wcs_types(struct wcsprm *wcs) +@@ -2617,63 +2848,63 @@ int wcs_types(struct wcsprm *wcs) } for (i = 0; i < naxis; i++) { @@ -24605,7 +27948,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->types[i] += 2000; if (wcs->lng < 0) { wcs->lng = i; -@@ -2683,7 +2680,7 @@ int wcs_types(struct wcsprm *wcs) +@@ -2683,7 +2914,7 @@ int wcs_types(struct wcsprm *wcs) } else if (strcmp(ctypei, "DEC") == 0 || strcmp(ctypei+1, "LAT") == 0 || strcmp(ctypei+2, "LT") == 0) { @@ -24614,7 +27957,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->types[i] += 2001; if (wcs->lat < 0) { wcs->lat = i; -@@ -2691,19 +2688,19 @@ int wcs_types(struct wcsprm *wcs) +@@ -2691,19 +2922,19 @@ int wcs_types(struct wcsprm *wcs) } } else if (strcmp(ctypei, "CUBEFACE") == 0) { @@ -24637,7 +27980,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (wcs->spec < 0) wcs->spec = i; wcs->types[i] += 3000; } -@@ -2712,12 +2709,12 @@ int wcs_types(struct wcsprm *wcs) +@@ -2712,12 +2943,12 @@ int wcs_types(struct wcsprm *wcs) } @@ -24653,7 +27996,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (wcs->spec >= 0) { return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE), "Multiple spectral axes (in CTYPE%d%.1s and CTYPE%d%.1s)", -@@ -2730,19 +2727,19 @@ int wcs_types(struct wcsprm *wcs) +@@ -2730,19 +2961,19 @@ int wcs_types(struct wcsprm *wcs) } @@ -24676,7 +28019,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->types[i] = -1; return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE), "Unrecognized projection code (%s in CTYPE%d%.1s)", -@@ -2750,10 +2747,10 @@ int wcs_types(struct wcsprm *wcs) +@@ -2750,10 +2981,10 @@ int wcs_types(struct wcsprm *wcs) } } @@ -24689,7 +28032,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c sprintf(pcode, "%.3s", ctypei+5); if (strncmp(ctypei, "RA--", 4) == 0) { -@@ -2793,7 +2790,7 @@ int wcs_types(struct wcsprm *wcs) +@@ -2793,7 +3024,7 @@ int wcs_types(struct wcsprm *wcs) ndx = &wcs->lng; sprintf(requir, "%s-%s", wcs->lngtyp, pcode); } else { @@ -24698,7 +28041,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->types[i] = -1; wcs->lng = -1; -@@ -2806,11 +2803,11 @@ int wcs_types(struct wcsprm *wcs) +@@ -2806,11 +3037,11 @@ int wcs_types(struct wcsprm *wcs) if (wcs->lat >= 0) wcs->types[i]++; } else { @@ -24712,7 +28055,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs->lng = -1; wcs->lat = -1; return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE), "Inconsistent " -@@ -2823,19 +2820,19 @@ int wcs_types(struct wcsprm *wcs) +@@ -2823,19 +3054,19 @@ int wcs_types(struct wcsprm *wcs) } } @@ -24736,8 +28079,12 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c i = wcs->tab[j].map[m]; type = (wcs->types[i] / 100) % 10; -@@ -2850,7 +2847,7 @@ int wcs_types(struct wcsprm *wcs) - return 0; +@@ -2847,10 +3078,10 @@ int wcs_types(struct wcsprm *wcs) + } + } + +- return 0; ++ return WCSERR_SUCCESS; } -/* : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : */ @@ -24745,11 +28092,14 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c int wcs_units(struct wcsprm *wcs) -@@ -2867,15 +2864,15 @@ int wcs_units(struct wcsprm *wcs) +@@ -2867,15 +3098,18 @@ int wcs_units(struct wcsprm *wcs) naxis = wcs->naxis; for (i = 0; i < naxis; i++) { - /* Use types set by wcs_types(). */ ++ // Squeeze out trailing blanks. ++ wcsutil_null_fill(72, wcs->cunit[i]); ++ + // Use types set by wcs_types(). switch (wcs->types[i]/1000) { case 2: @@ -24764,7 +28114,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c strncpy(ctype, wcs->ctype[i], 8); ctype[8] = '\0'; spctyp(ctype, 0x0, 0x0, 0x0, units, 0x0, 0x0, 0x0); -@@ -2885,7 +2882,7 @@ int wcs_units(struct wcsprm *wcs) +@@ -2885,18 +3119,20 @@ int wcs_units(struct wcsprm *wcs) continue; } @@ -24773,7 +28123,8 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if ((wcs->types[i]/100)%10 == 5) { continue; } -@@ -2894,9 +2891,12 @@ int wcs_units(struct wcsprm *wcs) + +- wcsutil_null_fill(72, wcs->cunit[i]); if (wcs->cunit[i][0]) { if (wcsunitse(wcs->cunit[i], units, &scale, &offset, &power, &uniterr)) { @@ -24789,8 +28140,12 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c return WCSERR_BAD_COORD_TRANS; } -@@ -2919,7 +2919,7 @@ int wcs_units(struct wcsprm *wcs) - return 0; +@@ -2916,10 +3152,10 @@ int wcs_units(struct wcsprm *wcs) + } + } + +- return 0; ++ return WCSERR_SUCCESS; } -/*--------------------------------------------------------------------------*/ @@ -24798,7 +28153,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c int wcsp2s( struct wcsprm *wcs, -@@ -2943,7 +2943,7 @@ int wcsp2s( +@@ -2943,7 +3179,7 @@ int wcsp2s( struct prjprm *wcsprj = &(wcscel->prj); struct wcserr **err; @@ -24807,7 +28162,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (wcs == 0x0) return WCSERR_NULL_POINTER; err = &(wcs->err); -@@ -2951,19 +2951,19 @@ int wcsp2s( +@@ -2951,19 +3187,19 @@ int wcsp2s( if ((status = wcsset(wcs))) return status; } @@ -24830,7 +28185,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if ((istatp = calloc(ncoord, sizeof(int))) == 0x0) { return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } -@@ -2972,13 +2972,13 @@ int wcsp2s( +@@ -2972,13 +3208,13 @@ int wcsp2s( wcsutil_setAli(ncoord, 1, stat); @@ -24847,7 +28202,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c img = imgcrd + i; wrl = world + i; crvali = wcs->crval[i]; -@@ -2989,16 +2989,16 @@ int wcsp2s( +@@ -2989,16 +3225,16 @@ int wcsp2s( } } else if (wcs->types[i] == 2200) { @@ -24867,7 +28222,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c img = imgcrd; statp = stat; bits = (1 << i) | (1 << wcs->lat); -@@ -3039,7 +3039,7 @@ int wcsp2s( +@@ -3039,7 +3275,7 @@ int wcsp2s( } } @@ -24876,7 +28231,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c nx = ncoord; ny = 0; -@@ -3051,7 +3051,7 @@ int wcsp2s( +@@ -3051,7 +3287,7 @@ int wcsp2s( ny = 1; } @@ -24885,7 +28240,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if ((istat = celx2s(wcscel, nx, ny, nelem, nelem, imgcrd+i, imgcrd+wcs->lat, phi, theta, world+i, world+wcs->lat, istatp))) { -@@ -3063,7 +3063,7 @@ int wcsp2s( +@@ -3063,7 +3299,7 @@ int wcsp2s( } } @@ -24894,7 +28249,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (iso_x && iso_y) { wcsutil_setAll(ncoord, nelem, world+i); wcsutil_setAll(ncoord, nelem, world+wcs->lat); -@@ -3078,7 +3078,7 @@ int wcsp2s( +@@ -3078,7 +3314,7 @@ int wcsp2s( } } else if (type == 3 || type == 4) { @@ -24903,7 +28258,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c nx = ncoord; if ((iso_x = wcsutil_allEq(ncoord, nelem, imgcrd+i))) { nx = 1; -@@ -3086,7 +3086,7 @@ int wcsp2s( +@@ -3086,7 +3322,7 @@ int wcsp2s( istat = 0; if (wcs->types[i] == 3300) { @@ -24912,7 +28267,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c istat = spcx2s(&(wcs->spc), nx, nelem, nelem, imgcrd+i, world+i, istatp); if (istat) { -@@ -3096,7 +3096,7 @@ int wcsp2s( +@@ -3096,7 +3332,7 @@ int wcsp2s( } } } else if (type == 4) { @@ -24921,7 +28276,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c istat = logx2s(wcs->crval[i], nx, nelem, nelem, imgcrd+i, world+i, istatp); if (istat) { -@@ -3107,7 +3107,7 @@ int wcsp2s( +@@ -3107,7 +3343,7 @@ int wcsp2s( } } @@ -24930,7 +28285,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (iso_x) { wcsutil_setAll(ncoord, nelem, world+i); wcsutil_setAli(ncoord, 1, istatp); -@@ -3120,7 +3120,7 @@ int wcsp2s( +@@ -3120,7 +3356,7 @@ int wcsp2s( } @@ -24939,7 +28294,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c for (itab = 0; itab < wcs->ntab; itab++) { istat = tabx2s(wcs->tab + itab, ncoord, nelem, imgcrd, world, istatp); -@@ -3141,7 +3141,7 @@ int wcsp2s( +@@ -3141,7 +3377,7 @@ int wcsp2s( } @@ -24948,7 +28303,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c for (i = wcs->naxis; i < nelem; i++) { world[i] = 0.0; wcsutil_setAll(ncoord, nelem, world+i); -@@ -3152,7 +3152,7 @@ cleanup: +@@ -3152,7 +3388,7 @@ cleanup: return status; } @@ -24957,7 +28312,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c int wcss2p( struct wcsprm* wcs, -@@ -3178,7 +3178,7 @@ int wcss2p( +@@ -3178,7 +3414,7 @@ int wcss2p( struct wcserr **err; @@ -24966,7 +28321,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (wcs == 0x0) return WCSERR_NULL_POINTER; err = &(wcs->err); -@@ -3186,13 +3186,13 @@ int wcss2p( +@@ -3186,13 +3422,13 @@ int wcss2p( if ((status = wcsset(wcs))) return status; } @@ -24982,7 +28337,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if ((istatp = calloc(ncoord, sizeof(int))) == 0x0) { return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } -@@ -3202,13 +3202,13 @@ int wcss2p( +@@ -3202,13 +3438,13 @@ int wcss2p( wcsutil_setAli(ncoord, 1, stat); @@ -24999,7 +28354,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wrl = world + i; img = imgcrd + i; crvali = wcs->crval[i]; -@@ -3219,7 +3219,7 @@ int wcss2p( +@@ -3219,7 +3455,7 @@ int wcss2p( } } else if (wcs->types[i] == 2200) { @@ -25008,7 +28363,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c nlng = ncoord; nlat = 0; -@@ -3231,7 +3231,7 @@ int wcss2p( +@@ -3231,7 +3467,7 @@ int wcss2p( nlat = 1; } @@ -25017,7 +28372,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if ((istat = cels2x(wcscel, nlng, nlat, nelem, nelem, world+i, world+wcs->lat, phi, theta, imgcrd+i, imgcrd+wcs->lat, istatp))) { -@@ -3243,7 +3243,7 @@ int wcss2p( +@@ -3243,7 +3479,7 @@ int wcss2p( } } @@ -25026,7 +28381,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (isolng && isolat) { wcsutil_setAll(ncoord, nelem, imgcrd+i); wcsutil_setAll(ncoord, nelem, imgcrd+wcs->lat); -@@ -3257,16 +3257,16 @@ int wcss2p( +@@ -3257,16 +3493,16 @@ int wcss2p( wcsutil_setBit(ncoord, istatp, bits, stat); } @@ -25046,7 +28401,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c img = imgcrd; for (k = 0; k < ncoord; k++) { if (*(img+wcs->lat) < -0.5*offset) { -@@ -3293,7 +3293,7 @@ int wcss2p( +@@ -3293,7 +3529,7 @@ int wcss2p( } } else if (type == 3 || type == 4) { @@ -25055,7 +28410,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c nwrld = ncoord; if ((isospec = wcsutil_allEq(ncoord, nelem, world+i))) { nwrld = 1; -@@ -3301,7 +3301,7 @@ int wcss2p( +@@ -3301,7 +3537,7 @@ int wcss2p( istat = 0; if (wcs->types[i] == 3300) { @@ -25064,7 +28419,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c istat = spcs2x(&(wcs->spc), nwrld, nelem, nelem, world+i, imgcrd+i, istatp); if (istat) { -@@ -3311,7 +3311,7 @@ int wcss2p( +@@ -3311,7 +3547,7 @@ int wcss2p( } } } else if (type == 4) { @@ -25073,7 +28428,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c istat = logs2x(wcs->crval[i], nwrld, nelem, nelem, world+i, imgcrd+i, istatp); if (istat) { -@@ -3322,7 +3322,7 @@ int wcss2p( +@@ -3322,7 +3558,7 @@ int wcss2p( } } @@ -25082,7 +28437,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (isospec) { wcsutil_setAll(ncoord, nelem, imgcrd+i); wcsutil_setAli(ncoord, 1, istatp); -@@ -3335,7 +3335,7 @@ int wcss2p( +@@ -3335,7 +3571,7 @@ int wcss2p( } @@ -25091,7 +28446,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c for (itab = 0; itab < wcs->ntab; itab++) { istat = tabs2x(wcs->tab + itab, ncoord, nelem, world, imgcrd, istatp); -@@ -3356,14 +3356,14 @@ int wcss2p( +@@ -3356,14 +3592,14 @@ int wcss2p( } @@ -25108,7 +28463,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if ((istat = linx2p(&(wcs->lin), ncoord, nelem, imgcrd, pixcrd))) { status = wcserr_set(WCS_ERRMSG(wcs_linerr[istat])); goto cleanup; -@@ -3374,7 +3374,7 @@ cleanup: +@@ -3374,7 +3610,7 @@ cleanup: return status; } @@ -25117,7 +28472,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c int wcsmix( struct wcsprm *wcs, -@@ -3408,7 +3408,7 @@ int wcsmix( +@@ -3408,7 +3644,7 @@ int wcsmix( struct wcsprm wcs0; struct wcserr **err; @@ -25126,7 +28481,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (wcs == 0x0) return WCSERR_NULL_POINTER; err = &(wcs->err); -@@ -3420,24 +3420,24 @@ int wcsmix( +@@ -3416,28 +3652,33 @@ int wcsmix( + if ((status = wcsset(wcs))) return status; + } + ++ if (wcs->lng < 0 || wcs->lat < 0) { ++ return wcserr_set(WCSERR_SET(WCSERR_BAD_SUBIMAGE), ++ "Image does not have celestial axes"); ++ } ++ + worldlng = world + wcs->lng; worldlat = world + wcs->lat; @@ -25155,7 +28519,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c nstep = viter; if (nstep < 5) { nstep = 5; -@@ -3445,18 +3445,18 @@ int wcsmix( +@@ -3445,18 +3686,18 @@ int wcsmix( nstep = 10; } @@ -25179,7 +28543,22 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c lat0 = span[0]; *worldlat = lat0; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, -@@ -3488,7 +3488,7 @@ int wcsmix( +@@ -3469,7 +3710,7 @@ int wcsmix( + d0 = pixcrd[mixpix] - pixmix; + + dabs = fabs(d0); +- if (dabs < tol) return 0; ++ if (dabs < tol) return WCSERR_SUCCESS; + + lat1 = span[1]; + *worldlat = lat1; +@@ -3483,12 +3724,12 @@ int wcsmix( + d1 = pixcrd[mixpix] - pixmix; + + dabs = fabs(d1); +- if (dabs < tol) return 0; ++ if (dabs < tol) return WCSERR_SUCCESS; + lmin = lat1; dmin = dabs; @@ -25188,7 +28567,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (signbit(d0) != signbit(d1)) { crossed = 1; dx = d1; -@@ -3498,7 +3498,7 @@ int wcsmix( +@@ -3498,7 +3739,7 @@ int wcsmix( } for (retry = 0; retry < 4; retry++) { @@ -25197,14 +28576,15 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c while (lat0 > span[0]) { lat0 -= step; if (lat0 < span[0]) lat0 = span[0]; -@@ -3512,32 +3512,32 @@ int wcsmix( +@@ -3512,32 +3753,32 @@ int wcsmix( } d0 = pixcrd[mixpix] - pixmix; - /* Check for a solution. */ + // Check for a solution. dabs = fabs(d0); - if (dabs < tol) return 0; +- if (dabs < tol) return 0; ++ if (dabs < tol) return WCSERR_SUCCESS; - /* Record the point of closest approach. */ + // Record the point of closest approach. @@ -25236,7 +28616,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c lambda = d0/(d0-d1); if (lambda < 0.1) { lambda = 0.1; -@@ -3556,20 +3556,20 @@ int wcsmix( +@@ -3556,20 +3797,20 @@ int wcsmix( return status; } @@ -25244,12 +28624,14 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c + // Check for a solution. d = pixcrd[mixpix] - pixmix; dabs = fabs(d); - if (dabs < tol) return 0; +- if (dabs < tol) return 0; ++ if (dabs < tol) return WCSERR_SUCCESS; if (dlat < tol) { - /* An artifact of numerical imprecision. */ +- if (dabs < tol2) return 0; + // An artifact of numerical imprecision. - if (dabs < tol2) return 0; ++ if (dabs < tol2) return WCSERR_SUCCESS; - /* Must be a discontinuity. */ + // Must be a discontinuity. @@ -25261,7 +28643,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (dabs < dmin) { lmin = lat; dmin = dabs; -@@ -3584,14 +3584,14 @@ int wcsmix( +@@ -3584,14 +3825,14 @@ int wcsmix( } } @@ -25278,7 +28660,25 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (lmin == span[0]) break; if (lmin == span[1]) break; -@@ -3671,9 +3671,9 @@ int wcsmix( +@@ -3635,7 +3876,7 @@ int wcsmix( + } + d0m = fabs(pixcrd[mixpix] - pixmix); + +- if (d0m < tol) return 0; ++ if (d0m < tol) return WCSERR_SUCCESS; + + lat1m = (lat1 + lat)/2.0; + *worldlat = lat1m; +@@ -3648,7 +3889,7 @@ int wcsmix( + } + d1m = fabs(pixcrd[mixpix] - pixmix); + +- if (d1m < tol) return 0; ++ if (d1m < tol) return WCSERR_SUCCESS; + + if (d0m < d && d0m <= d1m) { + lat1 = lat; +@@ -3671,9 +3912,9 @@ int wcsmix( } } else { @@ -25290,7 +28690,21 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c lng0 = span[0]; *worldlng = lng0; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, -@@ -3704,7 +3704,7 @@ int wcsmix( +@@ -3686,7 +3927,7 @@ int wcsmix( + d0 = pixcrd[mixpix] - pixmix; + + dabs = fabs(d0); +- if (dabs < tol) return 0; ++ if (dabs < tol) return WCSERR_SUCCESS; + + lng1 = span[1]; + *worldlng = lng1; +@@ -3700,11 +3941,11 @@ int wcsmix( + d1 = pixcrd[mixpix] - pixmix; + + dabs = fabs(d1); +- if (dabs < tol) return 0; ++ if (dabs < tol) return WCSERR_SUCCESS; lmin = lng1; dmin = dabs; @@ -25299,7 +28713,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (signbit(d0) != signbit(d1)) { crossed = 1; dx = d1; -@@ -3714,7 +3714,7 @@ int wcsmix( +@@ -3714,7 +3955,7 @@ int wcsmix( } for (retry = 0; retry < 4; retry++) { @@ -25308,14 +28722,15 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c while (lng0 > span[0]) { lng0 -= step; if (lng0 < span[0]) lng0 = span[0]; -@@ -3728,32 +3728,32 @@ int wcsmix( +@@ -3728,32 +3969,32 @@ int wcsmix( } d0 = pixcrd[mixpix] - pixmix; - /* Check for a solution. */ + // Check for a solution. dabs = fabs(d0); - if (dabs < tol) return 0; +- if (dabs < tol) return 0; ++ if (dabs < tol) return WCSERR_SUCCESS; - /* Record the point of closest approach. */ + // Record the point of closest approach. @@ -25347,7 +28762,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c lambda = d0/(d0-d1); if (lambda < 0.1) { lambda = 0.1; -@@ -3772,20 +3772,20 @@ int wcsmix( +@@ -3772,20 +4013,20 @@ int wcsmix( return status; } @@ -25355,12 +28770,14 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c + // Check for a solution. d = pixcrd[mixpix] - pixmix; dabs = fabs(d); - if (dabs < tol) return 0; +- if (dabs < tol) return 0; ++ if (dabs < tol) return WCSERR_SUCCESS; if (dlng < tol) { - /* An artifact of numerical imprecision. */ +- if (dabs < tol2) return 0; + // An artifact of numerical imprecision. - if (dabs < tol2) return 0; ++ if (dabs < tol2) return WCSERR_SUCCESS; - /* Must be a discontinuity. */ + // Must be a discontinuity. @@ -25372,7 +28789,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (dabs < dmin) { lmin = lng; dmin = dabs; -@@ -3800,14 +3800,14 @@ int wcsmix( +@@ -3800,14 +4041,14 @@ int wcsmix( } } @@ -25389,7 +28806,25 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (lmin == span[0]) break; if (lmin == span[1]) break; -@@ -3889,7 +3889,7 @@ int wcsmix( +@@ -3851,7 +4092,7 @@ int wcsmix( + } + d0m = fabs(pixcrd[mixpix] - pixmix); + +- if (d0m < tol) return 0; ++ if (d0m < tol) return WCSERR_SUCCESS; + + lng1m = (lng1 + lng)/2.0; + *worldlng = lng1m; +@@ -3864,7 +4105,7 @@ int wcsmix( + } + d1m = fabs(pixcrd[mixpix] - pixmix); + +- if (d1m < tol) return 0; ++ if (d1m < tol) return WCSERR_SUCCESS; + + if (d0m < d && d0m <= d1m) { + lng1 = lng; +@@ -3889,7 +4130,7 @@ int wcsmix( } @@ -25398,7 +28833,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c wcs0 = *wcs; wcs0.cel.euler[0] = -90.0; wcs0.cel.euler[1] = 0.0; -@@ -3897,10 +3897,10 @@ int wcsmix( +@@ -3897,10 +4138,10 @@ int wcsmix( wcs0.cel.euler[3] = 1.0; wcs0.cel.euler[4] = 0.0; @@ -25411,7 +28846,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c *phi = 0.0; *theta = -*theta; sphx2s(wcscel->euler, 1, 1, 1, 1, phi, theta, &lng, &lat); -@@ -3919,11 +3919,11 @@ int wcsmix( +@@ -3919,11 +4160,11 @@ int wcsmix( *worldlng = lng; } @@ -25425,7 +28860,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c *worldlng = -180.0; *worldlat = *theta; if ((status = wcss2p(&wcs0, 1, 0, world, phi, theta, imgcrd, pixcrd, -@@ -3937,15 +3937,15 @@ int wcsmix( +@@ -3937,15 +4178,15 @@ int wcsmix( } d0 = pixcrd[mixpix] - pixmix; @@ -25436,7 +28871,8 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c + // Recall saved world coordinates. *worldlng = lng; *worldlat = lat; - return 0; +- return 0; ++ return WCSERR_SUCCESS; } - /* Search for a crossing interval. */ @@ -25444,7 +28880,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c phi0 = -180.0; for (k = -179; k <= 180; k++) { phi1 = (double) k; -@@ -3961,16 +3961,16 @@ int wcsmix( +@@ -3961,16 +4202,16 @@ int wcsmix( } d1 = pixcrd[mixpix] - pixmix; @@ -25456,7 +28892,8 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c + // Recall saved world coordinates. *worldlng = lng; *worldlat = lat; - return 0; +- return 0; ++ return WCSERR_SUCCESS; } - /* Is it a crossing interval? */ @@ -25464,7 +28901,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c if (signbit(d0) != signbit(d1)) break; phi0 = phi1; -@@ -3978,7 +3978,7 @@ int wcsmix( +@@ -3978,7 +4219,7 @@ int wcsmix( } for (iter = 1; iter <= niter; iter++) { @@ -25473,7 +28910,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c lambda = d0/(d0-d1); if (lambda < 0.1) { lambda = 0.1; -@@ -3998,11 +3998,11 @@ int wcsmix( +@@ -3998,14 +4239,14 @@ int wcsmix( return status; } @@ -25486,8 +28923,12 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c + // Recall saved world coordinates. *worldlng = lng; *worldlat = lat; - return 0; -@@ -4019,11 +4019,11 @@ int wcsmix( +- return 0; ++ return WCSERR_SUCCESS; + } + + if (signbit(d0) == signbit(d)) { +@@ -4019,11 +4260,199 @@ int wcsmix( } @@ -25497,21 +28938,218 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c } -/*--------------------------------------------------------------------------*/ ++//---------------------------------------------------------------------------- ++ ++int wcsccs( ++ struct wcsprm *wcs, ++ double lng2P1, ++ double lat2P1, ++ double lng1P2, ++ const char *clng, ++ const char *clat, ++ const char *radesys, ++ double equinox, ++ const char *alt) ++ ++{ ++ static const char *function = "wcsccs"; ++ ++ int status; ++ ++ // Initialize if required. ++ if (wcs == 0x0) return WCSERR_NULL_POINTER; ++ struct wcserr **err = &(wcs->err); ++ ++ if (wcs->flag != WCSSET) { ++ if ((status = wcsset(wcs))) return status; ++ } ++ ++ if (wcs->lng < 0 || wcs->lat < 0) { ++ return wcserr_set(WCSERR_SET(WCSERR_BAD_SUBIMAGE), ++ "Image does not have celestial axes"); ++ } ++ ++ // (lng1XX,lat1XX) ...longitude and latitude of XX in the old system. ++ // (lng2XX,lat2XX) ...longitude and latitude of XX in the new system. ++ // XX = NP ...natuve pole, ++ // P1 ...pole of the old system, ++ // P2 ...pole of the new system, ++ // FP ...fiducial point. ++ ++ // Set up the transformation from the old to the new system. ++ double euler12[5]; ++ euler12[0] = lng2P1; ++ euler12[1] = 90.0 - lat2P1; ++ euler12[2] = lng1P2; ++ euler12[3] = cosd(euler12[1]); ++ euler12[4] = sind(euler12[1]); ++ ++ // Transform coordinates of the fiducial point (FP) to the new system. ++ double lng1FP = wcs->crval[wcs->lng]; ++ double lat1FP = wcs->crval[wcs->lat]; ++ double lng2FP, lat2FP; ++ (void)sphx2s(euler12, 1, 1, 1, 1, &lng1FP, &lat1FP, &lng2FP, &lat2FP); ++ ++ // Compute native coordinates of the new pole (noting lat1P2 == lat2P1). ++ double phiP2, thetaP2; ++ (void)sphs2x(wcs->cel.euler, 1, 1, 1, 1, &lng1P2, &lat2P1, ++ &phiP2, &thetaP2); ++ ++ if (fabs(lat2FP) == 90.0 || fabs(thetaP2) == 90.0) { ++ // If one of the poles of the new system is at the fiducial point, then ++ // lng2FP is indeterminate, and if one of them is at the native pole, then ++ // phiP2 is indeterminate. We have to work harder to obtain these values. ++ ++ // Compute coordinates of the native pole (NP) in the old and new systems. ++ double phiNP = 0.0, thetaNP = 90.0; ++ double lng1NP, lat1NP; ++ (void)sphx2s(wcs->cel.euler, 1, 1, 1, 1, &phiNP, &thetaNP, ++ &lng1NP, &lat1NP); ++ ++ double lng2NP, lat2NP; ++ (void)sphx2s(euler12, 1, 1, 1, 1, &lng1NP, &lat1NP, &lng2NP, &lat2NP); ++ ++ // Native latitude and longitude of the fiducial point, (phi0,theta0). ++ double phiFP = wcs->cel.prj.phi0; ++ double thetaFP = wcs->cel.prj.theta0; ++ ++ if (fabs(lat2NP) == 90.0) { ++ // Following WCS Paper II equations (3) and (4), we are free to choose ++ // phiP2 and set lng2NP accordingly. So set phiP2 to its default value ++ // for the projection. ++ if (thetaFP < lat2FP) { ++ phiP2 = 0.0; ++ } else { ++ phiP2 = 180.0; ++ } ++ ++ // Compute coordinates in the old system of test point X. ++ double phiX = 0.0, thetaX = 0.0; ++ double lng1X, lat1X; ++ (void)sphx2s(wcs->cel.euler, 1, 1, 1, 1, &phiX, &thetaX, ++ &lng1X, &lat1X); ++ ++ // Ensure that lng1X is not indeterminate. ++ if (fabs(lat1X) == 90.0) { ++ phiX = 90.0; ++ (void)sphx2s(wcs->cel.euler, 1, 1, 1, 1, &phiX, &thetaX, ++ &lng1X, &lat1X); ++ } ++ ++ // Compute coordinates in the new system of test point X. ++ double lng2X, lat2X; ++ (void)sphx2s(euler12, 1, 1, 1, 1, &lng1X, &lat1X, &lng2X, &lat2X); ++ ++ // Apply WCS Paper II equations (3) and (4). ++ if (lat2NP == +90.0) { ++ lng2NP = lng2X + (phiP2 - phiX) + 180.0; ++ } else { ++ lng2NP = lng2X - (phiP2 - phiX); ++ } ++ ++ } else { ++ // For (lng2NP + 90, 0), WCS Paper II equation (5) reduces to ++ // phi = phiP2 - 90. ++ double lng2X = lng2NP + 90.0; ++ double lat2X = 0.0; ++ double lng1X, lat1X; ++ (void)sphs2x(euler12, 1, 1, 1, 1, &lng2X, &lat2X, &lng1X, &lat1X); ++ ++ double phiX, thetaX; ++ (void)sphs2x(wcs->cel.euler, 1, 1, 1, 1, &lng1X, &lat1X, ++ &phiX, &thetaX); ++ ++ phiP2 = phiX + 90.0; ++ } ++ ++ // Compute the longitude of the fiducial point in the new system. ++ double eulerN2[5]; ++ eulerN2[0] = lng2NP; ++ eulerN2[1] = 90.0 - lat2NP; ++ eulerN2[2] = phiP2; ++ eulerN2[3] = cosd(eulerN2[1]); ++ eulerN2[4] = sind(eulerN2[1]); ++ ++ (void)sphx2s(eulerN2, 1, 1, 1, 1, &phiFP, &thetaFP, &lng2FP, &lat2FP); ++ } ++ ++ // Update reference values in wcsprm. ++ wcs->flag = 0; ++ wcs->crval[wcs->lng] = lng2FP; ++ wcs->crval[wcs->lat] = lat2FP; ++ wcs->lonpole = phiP2; ++ wcs->latpole = thetaP2; ++ ++ // Update wcsprm::ctype. ++ if (clng) { ++ strncpy(wcs->ctype[wcs->lng], clng, 4); ++ for (int i = 0; i < 4; i++) { ++ if (wcs->ctype[wcs->lng][i] == '\0') { ++ wcs->ctype[wcs->lng][i] = '-'; ++ } ++ } ++ } ++ ++ if (clat) { ++ strncpy(wcs->ctype[wcs->lat], clat, 4); ++ for (int i = 0; i < 4; i++) { ++ if (wcs->ctype[wcs->lat][i] == '\0') { ++ wcs->ctype[wcs->lat][i] = '-'; ++ } ++ } ++ } ++ ++ // Update auxiliary values. ++ if (strncmp(wcs->ctype[wcs->lng], "RA--", 4) == 0 && ++ strncmp(wcs->ctype[wcs->lat], "DEC-", 4) == 0) { ++ // Transforming to equatorial coordinates. ++ if (radesys) { ++ strncpy(wcs->radesys, radesys, 71); ++ } ++ ++ if (equinox != 0.0) { ++ wcs->equinox = equinox; ++ } ++ } else { ++ // Meaningless for other than equatorial coordinates. ++ memset(wcs->radesys, 0, 72); ++ wcs->equinox = UNDEFINED; ++ } ++ ++ if (alt && *alt) { ++ wcs->alt[0] = *alt; ++ } ++ ++ // Reset the struct. ++ if ((status = wcsset(wcs))) return status; ++ ++ return WCSERR_SUCCESS; ++} ++ +//---------------------------------------------------------------------------- int wcssptr( struct wcsprm *wcs, -@@ -4037,7 +4037,7 @@ int wcssptr( - double cdelt, crval; - struct wcserr **err; +@@ -4033,21 +4462,20 @@ int wcssptr( + { + static const char *function = "wcssptr"; + +- int j, status; +- double cdelt, crval; +- struct wcserr **err; ++ int status; - /* Initialize if required. */ + // Initialize if required. if (wcs == 0x0) return WCSERR_NULL_POINTER; - err = &(wcs->err); +- err = &(wcs->err); ++ struct wcserr **err = &(wcs->err); -@@ -4047,7 +4047,7 @@ int wcssptr( + if (wcs->flag != WCSSET) { + if ((status = wcsset(wcs))) return status; + } ++ int j; if ((j = *i) < 0) { if ((j = wcs->spec) < 0) { - /* Look for a linear spectral axis. */ @@ -25519,25 +29157,28 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c for (j = 0; j < wcs->naxis; j++) { if (wcs->types[j]/100 == 30) { break; -@@ -4055,7 +4055,7 @@ int wcssptr( +@@ -4055,16 +4483,17 @@ int wcssptr( } if (j >= wcs->naxis) { - /* No spectral axis. */ + // No spectral axis. return wcserr_set(WCSERR_SET(WCSERR_BAD_SUBIMAGE), - "No spectral axis found."); +- "No spectral axis found."); ++ "No spectral axis found"); } -@@ -4064,7 +4064,7 @@ int wcssptr( + } + *i = j; } - /* Translate the spectral axis. */ + // Translate the spectral axis. ++ double cdelt, crval; if ((status = spctrne(wcs->ctype[j], wcs->crval[j], wcs->cdelt[j], wcs->restfrq, wcs->restwav, ctype, &crval, &cdelt, &(wcs->spc.err)))) { -@@ -4072,21 +4072,21 @@ int wcssptr( +@@ -4072,21 +4501,24 @@ int wcssptr( } @@ -25554,7 +29195,11 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c spcfree(&(wcs->spc)); spcini(&(wcs->spc)); - return 0; +- return 0; ++ // Reset the struct. ++ if ((status = wcsset(wcs))) return status; ++ ++ return WCSERR_SUCCESS; } -/*--------------------------------------------------------------------------*/ @@ -25562,16 +29207,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.c #define STRINGIZE(s) STRINGIFY(s) #define STRINGIFY(s) #s -Index: astropy-4.2/cextern/wcslib/C/wcs.h +Index: astropy-4.2.1/cextern/wcslib/C/wcs.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcs.h -+++ astropy-4.2/cextern/wcslib/C/wcs.h +--- astropy-4.2.1.orig/cextern/wcslib/C/wcs.h ++++ astropy-4.2.1/cextern/wcslib/C/wcs.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -25585,15 +29230,48 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcs.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcs.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcs.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * -@@ -358,38 +355,39 @@ +@@ -67,12 +64,13 @@ + * set by the user, and others that are maintained by these routines, somewhat + * like a C++ class but with no encapsulation. + * +-* wcsnpv(), wcsnps(), wcsini(), wcsinit(), wcssub(), and wcsfree() are +-* provided to manage the wcsprm struct and another, wcsprt(), prints its +-* contents. Refer to the description of the wcsprm struct for an explanation +-* of the anticipated usage of these routines. wcscopy(), which does a deep +-* copy of one wcsprm struct to another, is defined as a preprocessor macro +-* function that invokes wcssub(). ++* wcsnpv(), wcsnps(), wcsini(), wcsinit(), wcssub(), wcsfree(), and wcstrim(), ++* are provided to manage the wcsprm struct, wcssize() computes its total size ++* including allocated memory, and wcsprt() prints its contents. Refer to the ++* description of the wcsprm struct for an explanation of the anticipated usage ++* of these routines. wcscopy(), which does a deep copy of one wcsprm struct ++* to another, is defined as a preprocessor macro function that invokes ++* wcssub(). + * + * wcsperr() prints the error message(s) (if any) stored in a wcsprm struct, + * and the linprm, celprm, prjprm, spcprm, and tabprm structs that it contains. +@@ -91,8 +89,10 @@ + * pixel coordinate a hybrid routine, wcsmix(), iteratively solves for the + * unknown elements. + * +-* wcssptr() translates the spectral axis in a wcsprm struct. For example, a +-* 'FREQ' axis may be translated into 'ZOPT-F2W' and vice versa. ++* wcsccs() changes the celestial coordinate system of a wcsprm struct, for ++* example, from equatorial to galactic, and wcssptr() translates the spectral ++* axis. For example, a 'FREQ' axis may be translated into 'ZOPT-F2W' and vice ++* versa. + * + * wcslib_version() returns the WCSLIB version number. + * +@@ -358,38 +358,39 @@ * wcsprm::err if enabled, see wcserr_enable(). * * Notes: @@ -25665,7 +29343,108 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.h * * * wcscompare() - Compare two wcsprm structs for equality -@@ -561,9 +559,9 @@ +@@ -450,7 +451,7 @@ + * PLEASE NOTE: wcsfree() must not be invoked on a wcsprm struct that was not + * initialized by wcsinit(). + * +-* Returned: ++* Given and returned: + * wcs struct wcsprm* + * Coordinate transformation parameters. + * +@@ -460,6 +461,91 @@ + * 1: Null wcsprm pointer passed. + * + * ++* wcstrim() - Free unused arrays in the wcsprm struct ++* --------------------------------------------------- ++* wcstrim() frees memory allocated by wcsinit() for arrays in the wcsprm ++* struct that remains unused after it has been set up by wcsset(). ++* ++* The free'd array members are associated with FITS WCS keyrecords that are ++* rarely used and usually just bloat the struct: wcsprm::crota, wcsprm::colax, ++* wcsprm::cname, wcsprm::crder, wcsprm::csyer, wcsprm::czphs, and ++* wcsprm::cperi. If unused, wcsprm::pv, wcsprm::ps, and wcsprm::cd are also ++* freed. ++* ++* Once these arrays have been freed, a test such as ++= ++= if (!undefined(wcs->cname[i])) {...} ++= ++* must be protected as follows ++= ++= if (wcs->cname && !undefined(wcs->cname[i])) {...} ++= ++* In addition, if wcsprm::npv is non-zero but less than wcsprm::npvmax, then ++* the unused space in wcsprm::pv will be recovered (using realloc()). ++* Likewise for wcsprm::ps. ++* ++* Given and returned: ++* wcs struct wcsprm* ++* Coordinate transformation parameters. ++* ++* Function return value: ++* int Status return value: ++* 0: Success. ++* 1: Null wcsprm pointer passed. ++* 14: wcsprm struct is unset. ++* ++* ++* wcssize() - Compute the size of a wcsprm struct ++* ----------------------------------------------- ++* wcssize() computes the full size of a wcsprm struct, including allocated ++* memory. ++* ++* Given: ++* wcs const struct wcsprm* ++* Coordinate transformation parameters. ++* ++* If NULL, the base size of the struct and the allocated ++* size are both set to zero. ++* ++* Returned: ++* sizes int[2] The first element is the base size of the struct as ++* returned by sizeof(struct wcsprm). The second element ++* is the total allocated size, in bytes, assuming that ++* the allocation was done by wcsini(). This figure ++* includes memory allocated for members of constituent ++* structs, such as wcsprm::lin. ++* ++* It is not an error for the struct not to have been set ++* up via wcsset(), which normally results in additional ++* memory allocation. ++* ++* Function return value: ++* int Status return value: ++* 0: Success. ++* ++* ++* auxsize() - Compute the size of a auxprm struct ++* ----------------------------------------------- ++* auxsize() computes the full size of a auxprm struct, including allocated ++* memory. ++* ++* Given: ++* aux const struct auxprm* ++* Auxiliary coordinate information. ++* ++* If NULL, the base size of the struct and the allocated ++* size are both set to zero. ++* ++* Returned: ++* sizes int[2] The first element is the base size of the struct as ++* returned by sizeof(struct auxprm). The second element ++* is the total allocated size, in bytes, currently zero. ++* ++* Function return value: ++* int Status return value: ++* 0: Success. ++* ++* + * wcsprt() - Print routine for the wcsprm struct + * ---------------------------------------------- + * wcsprt() prints the contents of a wcsprm struct using wcsprintf(). Mainly +@@ -561,9 +647,9 @@ * wcsprm::err if enabled, see wcserr_enable(). * * Notes: @@ -25678,7 +29457,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.h * * * wcsp2s() - Pixel-to-world transformation -@@ -780,31 +778,31 @@ +@@ -780,31 +866,167 @@ * wcsprm::err if enabled, see wcserr_enable(). * * Notes: @@ -25732,10 +29511,158 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.h +* compute-limited applications more efficient special-case solvers could +* be written for simple projections, for example non-oblique cylindrical +* projections. ++* ++* ++* wcsccs() - Change celestial coordinate system ++* --------------------------------------------- ++* wcsccs() changes the celestial coordinate system of a wcsprm struct. For ++* example, from equatorial to galactic coordinates. ++* ++* Parameters that define the spherical coordinate transformation, essentially ++* being three Euler angles, must be provided. Thereby wcsccs() does not need ++* prior knowledge of specific celestial coordinate systems. It also has the ++* advantage of making it completely general. ++* ++* Auxiliary members of the wcsprm struct relating to equatorial celestial ++* coordinate systems may also be changed. ++* ++* Only orthodox spherical coordinate systems are supported. That is, they ++* must be right-handed, with latitude increasing from zero at the equator to ++* +90 degrees at the pole. This precludes systems such as aziumuth and zenith ++* distance, which, however, could be handled as negative azimuth and ++* elevation. ++* ++* PLEASE NOTE: Information in the wcsprm struct relating to the original ++* coordinate system will be overwritten and therefore lost. If this is ++* undesirable, invoke wcsccs() on a copy of the struct made with wcssub(). ++* The wcsprm struct is reset on return with an explicit call to wcsset(). ++* ++* Given and returned: ++* wcs struct wcsprm* ++* Coordinate transformation parameters. Particular ++* "values to be given" elements of the wcsprm struct ++* are modified. ++* ++* Given: ++* lng2p1, ++* lat2p1 double Longitude and latitude in the new celestial coordinate ++* system of the pole (i.e. latitude +90) of the original ++* system [deg]. See notes 1 and 2 below. ++* ++* lng1p2 double Longitude in the original celestial coordinate system ++* of the pole (i.e. latitude +90) of the new system ++* [deg]. See note 1 below. ++* ++* clng,clat const char* ++* Longitude and latitude identifiers of the new CTYPEia ++* celestial axis codes, without trailing dashes. For ++* example, "RA" and "DEC" or "GLON" and "GLAT". Up to ++* four characters are used, longer strings need not be ++* null-terminated. ++* ++* radesys const char* ++* Used when transforming to equatorial coordinates, ++* identified by clng == "RA" and clat = "DEC". May be ++* set to the null pointer to preserve the current value. ++* Up to 71 characters are used, longer strings need not ++* be null-terminated. ++* ++* If the new coordinate system is anything other than ++* equatorial, then wcsprm::radesys will be cleared. ++* ++* equinox double Used when transforming to equatorial coordinates. May ++* be set to zero to preserve the current value. ++* ++* If the new coordinate system is not equatorial, then ++* wcsprm::equinox will be marked as undefined. ++* ++* alt const char* ++* Character code for alternate coordinate descriptions ++* (i.e. the 'a' in keyword names such as CTYPEia). This ++* is blank for the primary coordinate description, or ++* one of the 26 upper-case letters, A-Z. May be set to ++* the null pointer, or null string if no change is ++* required. ++* ++* Function return value: ++* int Status return value: ++* 0: Success. ++* 1: Null wcsprm pointer passed. ++* 12: Invalid subimage specification (no celestial ++* axes). ++* ++* Notes: ++* 1: Follows the prescription given in WCS Paper II, Sect. 2.7 for changing ++* celestial coordinates. ++* ++* The implementation takes account of indeterminacies that arise in that ++* prescription in the particular cases where one of the poles of the new ++* system is at the fiducial point, or one of them is at the native pole. ++* ++* 2: If lat2p1 == +90, i.e. where the poles of the two coordinate systems ++* coincide, then the spherical coordinate transformation becomes a simple ++* change in origin of longitude given by ++* lng2 = lng1 + (lng2p1 - lng1p2 - 180), and lat2 = lat1, where ++* (lng2,lat2) are coordinates in the new system, and (lng1,lat1) are ++* coordinates in the original system. ++* ++* Likewise, if lat2p1 == -90, then lng2 = -lng1 + (lng2p1 + lng1p2), and ++* lat2 = -lat1. ++* ++* 3: For example, if the original coordinate system is B1950 equatorial and ++* the desired new coordinate system is galactic, then ++* ++* - (lng2p1,lat2p1) are the galactic coordinates of the B1950 celestial ++* pole, defined by the IAU to be (123.0,+27.4), and lng1p2 is the B1950 ++* right ascension of the galactic pole, defined as 192.25. Clearly ++* these coordinates are fixed for a particular coordinate ++* transformation. ++* ++* - (clng,clat) would be 'GLON' and 'GLAT', these being the FITS standard ++* identifiers for galactic coordinates. ++* ++* - Since the new coordinate system is not equatorial, wcsprm::radesys ++* and wcsprm::equinox will be cleared. ++* ++* 4. The coordinates required for some common transformations (obtained from ++* https://ned.ipac.caltech.edu/coordinate_calculator) are as follows: ++* ++= (123.0000,+27.4000) galactic coordinates of B1950 celestial pole, ++= (192.2500,+27.4000) B1950 equatorial coordinates of galactic pole. ++* ++= (122.9319,+27.1283) galactic coordinates of J2000 celestial pole, ++= (192.8595,+27.1283) J2000 equatorial coordinates of galactic pole. ++* ++= (359.6774,+89.7217) B1950 equatorial coordinates of J2000 pole, ++= (180.3162,+89.7217) J2000 equatorial coordinates of B1950 pole. ++* ++= (270.0000,+66.5542) B1950 equatorial coordinates of B1950 ecliptic pole, ++= ( 90.0000,+66.5542) B1950 ecliptic coordinates of B1950 celestial pole. ++* ++= (270.0000,+66.5607) J2000 equatorial coordinates of J2000 ecliptic pole, ++= ( 90.0000,+66.5607) J2000 ecliptic coordinates of J2000 celestial pole. ++* ++= ( 26.7315,+15.6441) supergalactic coordinates of B1950 celestial pole, ++= (283.1894,+15.6441) B1950 equatorial coordinates of supergalactic pole. ++* ++= ( 26.4505,+15.7089) supergalactic coordinates of J2000 celestial pole, ++= (283.7542,+15.7089) J2000 equatorial coordinates of supergalactic pole. * * * wcssptr() - Spectral axis translation -@@ -928,8 +926,8 @@ +@@ -812,6 +1034,11 @@ + * wcssptr() translates the spectral axis in a wcsprm struct. For example, a + * 'FREQ' axis may be translated into 'ZOPT-F2W' and vice versa. + * ++* PLEASE NOTE: Information in the wcsprm struct relating to the original ++* coordinate system will be overwritten and therefore lost. If this is ++* undesirable, invoke wcssptr() on a copy of the struct made with wcssub(). ++* The wcsprm struct is reset on return with an explicit call to wcsset(). ++* + * Given and returned: + * wcs struct wcsprm* + * Coordinate transformation parameters. +@@ -928,8 +1155,8 @@ * - wcsprm::wtb. * * This signals the initialization routine, wcsset(), to recompute the @@ -25746,7 +29673,83 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.h * * PLEASE NOTE: flag should be set to -1 when wcsinit() is called for the * first time for a particular wcsprm struct in order to initialize memory -@@ -1730,7 +1728,7 @@ +@@ -1101,38 +1328,45 @@ + * + * - Bit 1: CDi_ja is present. + * +-* Matrix elements in the IRAF convention are +-* equivalent to the product CDi_ja = CDELTia * PCi_ja, but the +-* defaults differ from that of the PCi_ja matrix. If one or more +-* CDi_ja keywords are present then all unspecified CDi_ja default to +-* zero. If no CDi_ja (or CROTAi) keywords are present, then the +-* header is assumed to be in PCi_ja form whether or not any PCi_ja +-* keywords are present since this results in an interpretation of +-* CDELTia consistent with the original FITS specification. ++* Matrix elements in the IRAF convention are equivalent to the product ++* CDi_ja = CDELTia * PCi_ja, but the defaults differ from that of the ++* PCi_ja matrix. If one or more CDi_ja keywords are present then all ++* unspecified CDi_ja default to zero. If no CDi_ja (or CROTAi) keywords ++* are present, then the header is assumed to be in PCi_ja form whether ++* or not any PCi_ja keywords are present since this results in an ++* interpretation of CDELTia consistent with the original FITS ++* specification. + * + * While CDi_ja may not formally co-exist with PCi_ja, it may co-exist + * with CDELTia and CROTAi which are to be ignored. + * + * - Bit 2: CROTAi is present. + * +-* In the AIPS convention, CROTAi may only be +-* associated with the latitude axis of a celestial axis pair. It +-* specifies a rotation in the image plane that is applied AFTER the +-* CDELTia; any other CROTAi keywords are ignored. ++* In the AIPS convention, CROTAi may only be associated with the ++* latitude axis of a celestial axis pair. It specifies a rotation in ++* the image plane that is applied AFTER the CDELTia; any other CROTAi ++* keywords are ignored. + * + * CROTAi may not formally co-exist with PCi_ja. + * + * CROTAi and CDELTia may formally co-exist with CDi_ja but if so are to + * be ignored. + * +-* CDi_ja and CROTAi keywords, if found, are to be stored in the +-* wcsprm::cd and wcsprm::crota arrays which are dimensioned similarly to +-* wcsprm::pc and wcsprm::cdelt. FITS +-* header parsers should use the following procedure: ++* - Bit 3: PCi_ja + CDELTia was derived from CDi_ja by wcspcx(). ++* ++* This bit is set by wcspcx() when it derives PCi_ja and CDELTia from ++* CDi_ja via an orthonormal decomposition. In particular, it signals ++* wcsset() not to replace PCi_ja by a copy of CDi_ja with CDELTia set ++* to unity. + * +-* - Whenever a PCi_ja keyword is encountered: altlin |= 1; ++* CDi_ja and CROTAi keywords, if found, are to be stored in the wcsprm::cd ++* and wcsprm::crota arrays which are dimensioned similarly to wcsprm::pc ++* and wcsprm::cdelt. FITS header parsers should use the following ++* procedure: + * +-* - Whenever a CDi_ja keyword is encountered: altlin |= 2; ++* - Whenever a PCi_ja keyword is encountered: altlin |= 1; ++* ++* - Whenever a CDi_ja keyword is encountered: altlin |= 2; + * + * - Whenever a CROTAi keyword is encountered: altlin |= 4; + * +@@ -1141,8 +1375,9 @@ + * + * These alternate specifications of the linear transformation matrix are + * translated immediately to PCi_ja by wcsset() and are invisible to the +-* lower-level WCSLIB routines. In particular, wcsset() resets +-* wcsprm::cdelt to unity if CDi_ja is present (and no PCi_ja). ++* lower-level WCSLIB routines. In particular, unless bit 3 is also set, ++* wcsset() resets wcsprm::cdelt to unity if CDi_ja is present (and no ++* PCi_ja). + * + * If CROTAi are present but none is associated with the latitude axis + * (and no PCi_ja or CDi_ja), then wcsset() reverts to a unity PCi_ja +@@ -1730,7 +1965,7 @@ #ifdef __cplusplus extern "C" { @@ -25755,7 +29758,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.h #endif #define WCSSUB_LONGITUDE 0x1001 -@@ -1749,111 +1747,109 @@ extern "C" { +@@ -1749,111 +1984,110 @@ extern "C" { extern const char *wcs_errmsg[]; enum wcs_errmsg_enum { @@ -25800,7 +29803,8 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.h + WCSERR_NO_SOLUTION = 11, // No solution found in the specified + // interval. + WCSERR_BAD_SUBIMAGE = 12, // Invalid subimage specification. -+ WCSERR_NON_SEPARABLE = 13 // Non-separable subimage coordinate system. ++ WCSERR_NON_SEPARABLE = 13, // Non-separable subimage coordinate system. ++ WCSERR_UNSET = 14 // wcsprm struct is unset. }; @@ -25931,8 +29935,8 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.h + double *cd; // CDi_ja linear transformation matrix. + double *crota; // CROTAi keyvalues for each coord axis. + int altlin; // Alternative representations -+ // Bit 0: PCi_ja is present, -+ // Bit 1: CDi_ja is present, ++ // Bit 0: PCi_ja is present, ++ // Bit 1: CDi_ja is present, + // Bit 2: CROTAi is present. + int velref; // AIPS velocity code, VELREF. + @@ -25947,7 +29951,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.h char (*cname)[72]; double *crder; double *csyer; -@@ -1861,22 +1857,22 @@ struct wcsprm { +@@ -1861,22 +2095,22 @@ struct wcsprm { double *cperi; char wcsname[72]; @@ -25974,7 +29978,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.h double obsgeo[6]; char obsorbit[72]; char radesys[72]; -@@ -1888,40 +1884,40 @@ struct wcsprm { +@@ -1888,40 +2122,40 @@ struct wcsprm { char ssyssrc[72]; double velangl; @@ -26044,7 +30048,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.h int m_flag, m_naxis; double *m_crpix, *m_pc, *m_cdelt, *m_crval; char (*m_cunit)[72], (*m_ctype)[72]; -@@ -1936,7 +1932,7 @@ struct wcsprm { +@@ -1936,7 +2170,7 @@ struct wcsprm { struct wtbarr *m_wtb; }; @@ -26053,7 +30057,28 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.h #define WCSLEN (sizeof(struct wcsprm)/sizeof(int)) -@@ -1983,11 +1979,11 @@ int wcssptr(struct wcsprm *wcs, int *i, +@@ -1959,6 +2193,12 @@ int wcscompare(int cmp, double tol, cons + + int wcsfree(struct wcsprm *wcs); + ++int wcstrim(struct wcsprm *wcs); ++ ++int wcssize(const struct wcsprm *wcs, int sizes[2]); ++ ++int auxsize(const struct auxprm *aux, int sizes[2]); ++ + int wcsprt(const struct wcsprm *wcs); + + int wcsperr(const struct wcsprm *wcs, const char *prefix); +@@ -1979,15 +2219,19 @@ int wcsmix(struct wcsprm *wcs, int mixpi + double vstep, int viter, double world[], double phi[], + double theta[], double imgcrd[], double pixcrd[]); + ++int wcsccs(struct wcsprm *wcs, double lng2p1, double lat2p1, double lng1p2, ++ const char *clng, const char *clat, const char *radesys, ++ double equinox, const char *alt); ++ + int wcssptr(struct wcsprm *wcs, int *i, char ctype[9]); const char* wcslib_version(int vers[3]); @@ -26067,22 +30092,22 @@ Index: astropy-4.2/cextern/wcslib/C/wcs.h #define wcsini_errmsg wcs_errmsg #define wcssub_errmsg wcs_errmsg #define wcscopy_errmsg wcs_errmsg -@@ -2003,4 +1999,4 @@ const char* wcslib_version(int vers[3]); +@@ -2003,4 +2247,4 @@ const char* wcslib_version(int vers[3]); } #endif -#endif /* WCSLIB_WCS */ +#endif // WCSLIB_WCS -Index: astropy-4.2/cextern/wcslib/C/wcsbth.l +Index: astropy-4.2.1/cextern/wcslib/C/wcsbth.l =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcsbth.l -+++ astropy-4.2/cextern/wcslib/C/wcsbth.l +--- astropy-4.2.1.orig/cextern/wcslib/C/wcsbth.l ++++ astropy-4.2.1/cextern/wcslib/C/wcsbth.l @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -26096,11 +30121,19 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsbth.l,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcsbth.l,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcsbth.l,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * * wcsbth.l is a Flex description file containing the definition of a lexical -@@ -125,30 +122,30 @@ INLINE " "*(\/.*)? +@@ -76,6 +73,7 @@ + %option outfile="wcsbth.c" + %option prefix="wcsbth" + %option reentrant ++%option extra-type="struct wcsbth_extra *" + + /* Indices for parameterized keywords. */ + Z1 [0-9] +@@ -125,57 +123,34 @@ INLINE " "*(\/.*)? #include "wcsprintf.h" #include "wcsutil.h" @@ -26123,6 +30156,37 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l -#define BINTAB 0xC /* BIMGARR | PIXLIST, i.e. binary table */ - /* image array (without axis number) or */ - /* pixel list, e.g. LONPna or OBSGXn. */ +- +-static int wcsbth_scanner(char *header, int nkeyrec, int relax, int ctrl, +- int keysel, int *colsel, int *nreject, int *nwcs, +- struct wcsprm **wcs, yyscan_t yyscanner); +- +-/*--------------------------------------------------------------------------*/ +- +-int wcsbth( +- char *header, +- int nkeyrec, +- int relax, +- int ctrl, +- int keysel, +- int *colsel, +- int *nreject, +- int *nwcs, +- struct wcsprm **wcs) +- +-{ +- int status; +- yyscan_t yyscanner; +- int yylex_init(yyscan_t *yyscanner); +- int yylex_destroy(yyscan_t yyscanner); +- +- yylex_init(&yyscanner); +- status = wcsbth_scanner(header, nkeyrec, relax, ctrl, keysel, colsel, +- nreject, nwcs, wcs, yyscanner); +- yylex_destroy(yyscanner); +- +- return status; +-} + // Bit masks used for keyword types: +#define IMGAUX 0x1 // Auxiliary image header, e.g. LONPOLEa or + // DATE-OBS. @@ -26135,58 +30199,72 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l +#define BINTAB 0xC // BIMGARR | PIXLIST, i.e. binary table + // image array (without axis number) or + // pixel list, e.g. LONPna or OBSGXn. - - static int wcsbth_scanner(char *header, int nkeyrec, int relax, int ctrl, - int keysel, int *colsel, int *nreject, int *nwcs, - struct wcsprm **wcs, yyscan_t yyscanner); ++ ++// User data associated with yyscanner. ++struct wcsbth_extra { ++ // Values passed to YY_INPUT. ++ char *hdr; ++ int nkeyrec; -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- - - int wcsbth( - char *header, -@@ -175,7 +172,7 @@ int wcsbth( - return status; - } - --/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- ++ // Used in preempting the call to exit() by yy_fatal_error(). ++ jmp_buf abort_jmp_env; ++}; #define YY_DECL int wcsbth_scanner(char *header, int nkeyrec, int relax, \ int ctrl, int keysel, int *colsel, int *nreject, int *nwcs, \ -@@ -194,18 +191,18 @@ int wcsbth( +@@ -183,29 +158,28 @@ int wcsbth( + + #define YY_INPUT(inbuff, count, bufsize) \ + { \ +- if (wcsbth_nkeyrec) { \ +- strncpy(inbuff, wcsbth_hdr, 80); \ ++ if (yyextra->nkeyrec) { \ ++ strncpy(inbuff, yyextra->hdr, 80); \ + inbuff[80] = '\n'; \ +- wcsbth_hdr += 80; \ +- wcsbth_nkeyrec--; \ ++ yyextra->hdr += 80; \ ++ yyextra->nkeyrec--; \ + count = 81; \ + } else { \ + count = YY_NULL; \ } \ } -/* A convenience macro to get around incompatibilities between unput() and - yyless(): put yytext followed by a blank back onto the input stream. */ ++// Preempt the call to exit() by yy_fatal_error(). ++#define exit(status) longjmp(yyextra->abort_jmp_env, status); ++ +// A convenience macro to get around incompatibilities between unput() and +// yyless(): put yytext followed by a blank back onto the input stream. #define WCSBTH_PUTBACK \ sprintf(strtmp, "%s ", yytext); \ - iz = strlen(strtmp); \ +- iz = strlen(strtmp); \ ++ size_t iz = strlen(strtmp); \ while (iz) unput(strtmp[--iz]); -/* These global variables are required by YY_INPUT. */ -+// These global variables are required by YY_INPUT. - static char *wcsbth_hdr; - static int wcsbth_nkeyrec; - +-static char *wcsbth_hdr; +-static int wcsbth_nkeyrec; +- -/* Struct used internally for header bookkeeping. */ +// Struct used internally for header bookkeeping. struct wcsbth_alts { int ncol, ialt, icol, imgherit; short int (*arridx)[27]; -@@ -220,7 +217,7 @@ struct wcsbth_alts { +@@ -220,7 +194,8 @@ struct wcsbth_alts { unsigned char pad2[2]; }; -/* Internal helper functions. */ +// Internal helper functions. ++static YY_DECL; static int wcsbth_colax(struct wcsprm *wcs, struct wcsbth_alts *alts, int k, char a); static int wcsbth_final(struct wcsbth_alts *alts, int *nwcs, -@@ -232,24 +229,24 @@ static int wcsbth_init1(struct wcsbth_al +@@ -232,116 +207,99 @@ static int wcsbth_init1(struct wcsbth_al static int wcsbth_pass1(int keytype, int i, int j, int n, int k, char a, char ptype, struct wcsbth_alts *alts); @@ -26203,112 +30281,185 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l static int wcsbth_timepixr(double timepixr); -/* Used in preempting the call to exit() by yy_fatal_error(). */ -+// Used in preempting the call to exit() by yy_fatal_error(). - jmp_buf wcsbth_abort_jmp_env; - #define exit(status) longjmp(wcsbth_abort_jmp_env, status) - +-jmp_buf wcsbth_abort_jmp_env; +-#define exit(status) longjmp(wcsbth_abort_jmp_env, status) +- %} %% - /* Keyword indices, as used in the WCS papers, e.g. iVn_ma, TPn_ka. */ -+ // Keyword indices, as used in the WCS papers, e.g. iVn_ma, TPn_ka. - char a; - int i, j, k, m, n; - -@@ -268,37 +265,37 @@ jmp_buf wcsbth_abort_jmp_env; - int (*chekval)(double); - int (*special)(double *, const double *); +- char a; +- int i, j, k, m, n; +- +- char *cptr, *errmsg, errtxt[80], exclude[1000], gotone, *hptr, *keep, +- *keyname, *keyrec, ptype, strtmp[80]; +- int altlin, auxprm, ialt, icol, incl, imherit, inttmp, ipass, ipx, +- itmp, ix, jx, keytype, naux, nother, nsel, npass, nvalid, status, +- valtype; +- ptrdiff_t voff; +- size_t iz; ++ char *errmsg, errtxt[80], *keyname, strtmp[80]; ++ int auxprm, inttmp; + double dbltmp, dbl2tmp[2]; +- void *vptr, *wptr; +- struct wcsbth_alts alts; +- struct auxprm *auxp, auxtem; +- struct wcsprm *wcsp, wcstem; +- int (*chekval)(double); +- int (*special)(double *, const double *); ++ struct auxprm auxtem; ++ struct wcsprm wcstem; - /* The data structures produced. */ -+ // The data structures produced. ++ // Initialize returned values. ++ *nreject = 0; *nwcs = 0; *wcs = 0x0; - /* Parameters used to implement YY_INPUT. */ -+ // Parameters used to implement YY_INPUT. - wcsbth_hdr = header; - wcsbth_nkeyrec = nkeyrec; - +- wcsbth_hdr = header; +- wcsbth_nkeyrec = nkeyrec; +- - /* Our handle on the input stream. */ +- keyrec = header; +- hptr = header; +- keep = 0x0; + // Our handle on the input stream. - keyrec = header; - hptr = header; - keep = 0x0; ++ char *keyrec = header; ++ char *hptr = header; ++ char *keep = 0x0; ++ ++ // For keeping tallies of keywords found. ++ int nvalid = 0; ++ int nother = 0; - /* For keeping tallies of keywords found. */ -+ // For keeping tallies of keywords found. - *nreject = 0; - nvalid = 0; - nother = 0; +- *nreject = 0; +- nvalid = 0; +- nother = 0; ++ // Used to flag image header keywords that are always inherited. ++ int imherit = 1; - /* Used to flag image header keywords that are always inherited. */ -+ // Used to flag image header keywords that are always inherited. - imherit = 1; - +- imherit = 1; +- - /* If strict, then also reject. */ + // If strict, then also reject. if (relax & WCSHDR_strict) relax |= WCSHDR_reject; - /* Keyword parameters. */ -+ // Keyword parameters. - i = j = 0; - n = k = 0; - m = 0; - a = ' '; +- i = j = 0; +- n = k = 0; +- m = 0; +- a = ' '; ++ // Keyword indices, as used in the WCS papers, e.g. iVn_ma, TPn_ka. ++ int i = 0; ++ int j = 0; ++ int k = 0; ++ int n = 0; ++ int m = 0; ++ char a = ' '; - /* Header bookkeeping. */ + // Header bookkeeping. ++ struct wcsbth_alts alts; alts.ncol = 0; alts.arridx = 0x0; alts.pixlist = 0x0; -@@ -311,12 +308,12 @@ jmp_buf wcsbth_abort_jmp_env; + alts.npv = 0x0; + alts.nps = 0x0; + +- for (ialt = 0; ialt < 27; ialt++) { ++ for (int ialt = 0; ialt < 27; ialt++) { + alts.pixidx[ialt] = 0; + alts.pixnpv[ialt] = 0; alts.pixnps[ialt] = 0; } - /* For decoding the keyvalue. */ -+ // For decoding the keyvalue. - keytype = 0; - valtype = -1; - vptr = 0x0; - +- keytype = 0; +- valtype = -1; +- vptr = 0x0; +- - /* For keywords that require special handling. */ -+ // For keywords that require special handling. - altlin = 0; - ptype = ' '; - chekval = 0x0; -@@ -324,7 +321,7 @@ jmp_buf wcsbth_abort_jmp_env; - auxprm = 0; - naux = 0; - +- altlin = 0; +- ptype = ' '; +- chekval = 0x0; +- special = 0x0; +- auxprm = 0; +- naux = 0; +- - /* Selection by column number. */ +- nsel = colsel ? colsel[0] : 0; +- incl = (nsel > 0); +- for (icol = 0; icol < 1000; icol++) { ++ // For decoding the keyvalue. ++ int keytype = 0; ++ int valtype = -1; ++ void *vptr = 0x0; ++ ++ // For keywords that require special handling. ++ int altlin = 0; ++ char ptype = ' '; ++ int (*chekval)(double) = 0x0; ++ int (*special)(double *, const double *) = 0x0; ++ struct auxprm *auxp = 0x0; ++ int naux = 0; ++ + // Selection by column number. - nsel = colsel ? colsel[0] : 0; - incl = (nsel > 0); - for (icol = 0; icol < 1000; icol++) { -@@ -338,7 +335,7 @@ jmp_buf wcsbth_abort_jmp_env; ++ int nsel = colsel ? colsel[0] : 0; ++ int incl = (nsel > 0); ++ char exclude[1000]; ++ for (int icol = 0; icol < 1000; icol++) { + exclude[icol] = incl; + } +- for (icol = 1; icol <= abs(nsel); icol++) { +- itmp = colsel[icol]; ++ for (int icol = 1; icol <= abs(nsel); icol++) { ++ int itmp = colsel[icol]; + if (0 < itmp && itmp < 1000) { + exclude[itmp] = !incl; + } } exclude[0] = 0; - /* Selection by keyword type. */ +- itmp = keysel; +- keysel = 0; +- if (itmp) { + // Selection by keyword type. - itmp = keysel; - keysel = 0; - if (itmp) { -@@ -350,11 +347,11 @@ jmp_buf wcsbth_abort_jmp_env; ++ if (keysel) { ++ int itmp = keysel; ++ keysel = 0; + if (itmp & WCSHDR_IMGHEAD) keysel |= IMGHEAD; + if (itmp & WCSHDR_BIMGARR) keysel |= BIMGARR; + if (itmp & WCSHDR_PIXLIST) keysel |= PIXLIST; +@@ -350,13 +308,17 @@ jmp_buf wcsbth_abort_jmp_env; keysel = IMGHEAD | BINTAB; } - /* Control variables. */ -+ // Control variables. - ipass = 1; - npass = 2; - +- ipass = 1; +- npass = 2; +- - /* Return here via longjmp() invoked by yy_fatal_error(). */ +- if (setjmp(wcsbth_abort_jmp_env)) { +- return 4; ++ // Control variables. ++ int ipass = 1; ++ int npass = 2; ++ ++ // User data associated with yyscanner. ++ yyextra->hdr = header; ++ yyextra->nkeyrec = nkeyrec; ++ + // Return here via longjmp() invoked by yy_fatal_error(). - if (setjmp(wcsbth_abort_jmp_env)) { - return 4; ++ if (setjmp(yyextra->abort_jmp_env)) { ++ return WCSHDRERR_PARSER; } -@@ -379,7 +376,7 @@ jmp_buf wcsbth_abort_jmp_env; + + BEGIN(INITIAL); +@@ -379,7 +341,7 @@ jmp_buf wcsbth_abort_jmp_env; ^WCSAXES{ALT}=" "" "*{INTEGER} { if (!(keysel & IMGAXIS)) { @@ -26317,7 +30468,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } else { -@@ -404,7 +401,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -404,7 +366,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26326,7 +30477,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -415,12 +412,12 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -415,12 +377,12 @@ jmp_buf wcsbth_abort_jmp_env; ^WCAX{I3}{ALT}"= "" "*{INTEGER} { keyname = "WCAXna"; @@ -26342,7 +30493,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } else if (i < 0) { -@@ -440,7 +437,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -440,7 +402,7 @@ jmp_buf wcsbth_abort_jmp_env; ^WCST{I1}{ALT}" = "" "*{STRING} | ^WCST{I2}{ALT}" = "" "*{STRING} | ^WCST{I3}{ALT}"= "" "*{STRING} { @@ -26351,7 +30502,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l keyname = "WCSTna"; errmsg = "cross-references are not implemented"; BEGIN(ERROR); -@@ -449,7 +446,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -449,7 +411,7 @@ jmp_buf wcsbth_abort_jmp_env; ^WCSX{I1}{ALT}" = "" "*{STRING} | ^WCSX{I2}{ALT}" = "" "*{STRING} | ^WCSX{I3}{ALT}"= "" "*{STRING} { @@ -26360,7 +30511,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l keyname = "WCSXna"; errmsg = "cross-references are not implemented"; BEGIN(ERROR); -@@ -1247,7 +1244,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -1247,7 +1209,7 @@ jmp_buf wcsbth_abort_jmp_env; ^MJDREFI" " | ^MJD-REFI { if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) { @@ -26369,7 +30520,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l valtype = FLOAT; vptr = wcstem.mjdref; -@@ -1303,7 +1300,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -1303,7 +1265,7 @@ jmp_buf wcsbth_abort_jmp_env; ^JDREFI" " | ^JD-REFI { if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) { @@ -26378,7 +30529,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l valtype = FLOAT; vptr = wcstem.mjdref; special = wcsbth_jdrefi; -@@ -1850,7 +1847,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -1850,7 +1812,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26387,7 +30538,18 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -1971,7 +1968,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -1944,8 +1906,8 @@ jmp_buf wcsbth_abort_jmp_env; + } + + ^END" "{77} { +- if (wcsbth_nkeyrec) { +- wcsbth_nkeyrec = 0; ++ if (yyextra->nkeyrec) { ++ yyextra->nkeyrec = 0; + errmsg = "keyrecords following the END keyrecord were ignored"; + BEGIN(ERROR); + } else { +@@ -1971,7 +1933,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26396,7 +30558,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -1980,13 +1977,13 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -1980,13 +1942,13 @@ jmp_buf wcsbth_abort_jmp_env; 00{I1} { if (relax & WCSHDR_ALLIMG) { if (relax & WCSHDR_reject) { @@ -26412,7 +30574,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } -@@ -1997,7 +1994,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -1997,7 +1959,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26421,7 +30583,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2005,8 +2002,8 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2005,8 +1967,8 @@ jmp_buf wcsbth_abort_jmp_env; 0{ALT}" " | 00{ALT} | {Z3} { @@ -26432,7 +30594,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l if (relax & WCSHDR_ALLIMG) { errmsg = "axis number must exceed 0"; BEGIN(ERROR); -@@ -2018,21 +2015,21 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2018,21 +1980,21 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26457,7 +30619,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2076,7 +2073,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2076,7 +2038,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26466,7 +30628,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2119,7 +2116,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2119,7 +2081,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26475,7 +30637,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2158,7 +2155,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2158,7 +2120,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26484,7 +30646,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } -@@ -2169,7 +2166,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2169,7 +2131,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26493,7 +30655,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2184,8 +2181,8 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2184,8 +2146,8 @@ jmp_buf wcsbth_abort_jmp_env; {Z3}_{Z2} | {Z2}_{Z3} | {Z1}_{Z4} { @@ -26504,7 +30666,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l if (relax & WCSHDR_ALLIMG) { errmsg = "axis number must exceed 0"; BEGIN(ERROR); -@@ -2197,7 +2194,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2197,7 +2159,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26513,7 +30675,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2225,13 +2222,13 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2225,13 +2187,13 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26529,7 +30691,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l if (relax & WCSHDR_ALLIMG) { if (((altlin == 1) && (relax & WCSHDR_PC00i00j)) || ((altlin == 2) && (relax & WCSHDR_CD00i00j))) { -@@ -2248,7 +2245,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2248,7 +2210,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26538,7 +30700,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } -@@ -2259,7 +2256,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2259,7 +2221,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26547,7 +30709,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2292,7 +2289,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2292,7 +2254,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26556,7 +30718,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2350,7 +2347,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2350,7 +2312,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26565,7 +30727,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } -@@ -2361,7 +2358,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2361,7 +2323,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26574,7 +30736,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2371,7 +2368,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2371,7 +2333,7 @@ jmp_buf wcsbth_abort_jmp_env; yyless(0); BEGIN(CCCCCia); } else { @@ -26583,7 +30745,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2401,7 +2398,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2401,7 +2363,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26592,7 +30754,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2413,7 +2410,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2413,7 +2375,7 @@ jmp_buf wcsbth_abort_jmp_env; {ALT} | . { @@ -26601,7 +30763,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l if (imherit || (relax & (WCSHDR_AUXIMG | WCSHDR_ALLIMG))) { if (YY_START == CCCCCCCa) { sscanf(yytext, "%c", &a); -@@ -2431,21 +2428,21 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2431,21 +2393,21 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26626,7 +30788,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2494,7 +2491,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2494,7 +2456,7 @@ jmp_buf wcsbth_abort_jmp_env; {I1}_{I2}{ALT}" " | {I2}_{Z1}{ALT}" " | {I2}_{I2}{ALT} { @@ -26635,7 +30797,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l if (relax & WCSHDR_ALLIMG) { sscanf(yytext, "%d_%d%c", &i, &m, &a); keytype = IMGAXIS; -@@ -2507,7 +2504,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2507,7 +2469,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26644,7 +30806,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2546,7 +2543,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2546,7 +2508,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26653,7 +30815,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } -@@ -2557,7 +2554,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2557,7 +2519,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26662,7 +30824,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2573,8 +2570,8 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2573,8 +2535,8 @@ jmp_buf wcsbth_abort_jmp_env; {Z2}_{Z3} | {Z1}_{Z4} { if (relax & WCSHDR_ALLIMG) { @@ -26673,7 +30835,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l errmsg = "axis number must exceed 0"; BEGIN(ERROR); -@@ -2585,7 +2582,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2585,7 +2547,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26682,7 +30844,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2632,7 +2629,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2632,7 +2594,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26691,7 +30853,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2668,7 +2665,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2668,7 +2630,7 @@ jmp_buf wcsbth_abort_jmp_env; {I2}_{I3} | {I3}_{I2} | {I4}_{Z1} { @@ -26700,7 +30862,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l sscanf(yytext, "%d_%d", &n, &m); a = ' '; if (YY_START == TCn_ma) i = wcsbth_colax(*wcs, &alts, n, a); -@@ -2694,7 +2691,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2694,7 +2656,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26709,7 +30871,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l BEGIN(DISCARD); } } -@@ -2715,16 +2712,16 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2715,17 +2677,17 @@ jmp_buf wcsbth_abort_jmp_env; } =" "+ { @@ -26726,12 +30888,14 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l if (k && (exclude[n] != exclude[k])) { - /* For keywords such as TCn_ka, both columns must be excluded. - User error, so return immediately. */ +- return 3; + // For keywords such as TCn_ka, both columns must be excluded. + // User error, so return immediately. - return 3; ++ return WCSHDRERR_BAD_COLUMN; } else { -@@ -2744,18 +2741,18 @@ jmp_buf wcsbth_abort_jmp_env; + BEGIN(DISCARD); +@@ -2744,18 +2706,18 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(ERROR); } else { @@ -26754,7 +30918,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l vptr = 0x0; } -@@ -2786,7 +2783,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2786,7 +2748,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(COMMENT); } else { @@ -26763,7 +30927,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l sscanf(yytext, "%d", &inttmp); BEGIN(COMMENT); -@@ -2803,7 +2800,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2803,7 +2765,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(COMMENT); } else { @@ -26772,7 +30936,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l wcsutil_str2double(yytext, &dbltmp); if (chekval && chekval(dbltmp)) { -@@ -2825,7 +2822,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2825,7 +2787,7 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(COMMENT); } else { @@ -26781,20 +30945,25 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l wcsutil_str2double2(yytext, dbl2tmp); BEGIN(COMMENT); -@@ -2842,10 +2839,10 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2842,12 +2804,12 @@ jmp_buf wcsbth_abort_jmp_env; BEGIN(COMMENT); } else { - /* Read the keyvalue. */ +- strcpy(strtmp, yytext+1); + // Read the keyvalue. - strcpy(strtmp, yytext+1); ++ strcpy(strtmp, yytext+1); - /* Squeeze out repeated quotes. */ +- ix = 0; +- for (jx = 0; jx < 72; jx++) { + // Squeeze out repeated quotes. - ix = 0; - for (jx = 0; jx < 72; jx++) { ++ int ix = 0; ++ for (int jx = 0; jx < 72; jx++) { if (ix < jx) { -@@ -2873,28 +2870,28 @@ jmp_buf wcsbth_abort_jmp_env; + strtmp[ix] = strtmp[jx]; + } +@@ -2873,29 +2835,31 @@ jmp_buf wcsbth_abort_jmp_env; {INLINE}$ { if (ipass == 1) { @@ -26810,34 +30979,43 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l alts.ialt = 0; - /* Update each coordinate representation. */ +- gotone = 0; + // Update each coordinate representation. - gotone = 0; ++ int gotone = 0; ++ struct wcsprm *wcsp; while ((wcsp = wcsbth_idx(*wcs, &alts, keytype, n, a))) { gotone = 1; if (vptr) { ++ void *wptr; if (auxprm) { - /* Additional auxiliary parameter. */ + // Additional auxiliary parameter. auxp = wcsp->aux; - voff = (char *)vptr - (char *)(&auxtem); +- voff = (char *)vptr - (char *)(&auxtem); ++ ptrdiff_t voff = (char *)vptr - (char *)(&auxtem); wptr = (void *)((char *)auxp + voff); } else { - /* A parameter that lives directly in wcsprm. */ +- voff = (char *)vptr - (char *)(&wcstem); + // A parameter that lives directly in wcsprm. - voff = (char *)vptr - (char *)(&wcstem); ++ ptrdiff_t voff = (char *)vptr - (char *)(&wcstem); wptr = (void *)((char *)wcsp + voff); } -@@ -2903,7 +2900,7 @@ jmp_buf wcsbth_abort_jmp_env; + +@@ -2903,9 +2867,9 @@ jmp_buf wcsbth_abort_jmp_env; *((int *)wptr) = inttmp; } else if (valtype == FLOAT) { - /* Apply keyword parameterization. */ + // Apply keyword parameterization. if (ptype == 'v') { - ipx = (wcsp->npv)++; +- ipx = (wcsp->npv)++; ++ int ipx = (wcsp->npv)++; wcsp->pv[ipx].i = i; -@@ -2924,14 +2921,14 @@ jmp_buf wcsbth_abort_jmp_env; + wcsp->pv[ipx].m = m; + wptr = &(wcsp->pv[ipx].value); +@@ -2924,14 +2888,14 @@ jmp_buf wcsbth_abort_jmp_env; *((double *)wptr) = dbltmp; } @@ -26854,16 +31032,28 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l if (special) { special(wptr, dbl2tmp); } else { -@@ -2940,7 +2937,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -2940,9 +2904,9 @@ jmp_buf wcsbth_abort_jmp_env; } } else if (valtype == STRING) { - /* Apply keyword parameterization. */ + // Apply keyword parameterization. if (ptype == 's') { - ipx = wcsp->nps++; +- ipx = wcsp->nps++; ++ int ipx = wcsp->nps++; wcsp->ps[ipx].i = i; -@@ -3009,7 +3006,7 @@ jmp_buf wcsbth_abort_jmp_env; + wcsp->ps[ipx].m = m; + wptr = wcsp->ps[ipx].value; +@@ -2955,7 +2919,7 @@ jmp_buf wcsbth_abort_jmp_env; + wptr = *((char (**)[72])wptr) + (i - 1); + } + +- cptr = (char *)wptr; ++ char *cptr = (char *)wptr; + strcpy(cptr, strtmp); + } + } +@@ -3009,7 +2973,7 @@ jmp_buf wcsbth_abort_jmp_env; .*$ { if (ipass == npass) { if (ctrl < 0) { @@ -26872,7 +31062,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l keep = keyrec; } else if (2 < ctrl) { -@@ -3047,7 +3044,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -3047,7 +3011,7 @@ jmp_buf wcsbth_abort_jmp_env; naux += auxprm; @@ -26881,25 +31071,79 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l i = j = 0; n = k = 0; m = 0; -@@ -3069,7 +3066,7 @@ jmp_buf wcsbth_abort_jmp_env; +@@ -3069,8 +3033,9 @@ jmp_buf wcsbth_abort_jmp_env; } <> { - /* End-of-input. */ + // End-of-input. if (ipass == 1) { ++ int status; if ((status = wcsbth_init1(&alts, naux, nwcs, wcs)) || (*nwcs == 0 && ctrl == 0)) { -@@ -3178,20 +3175,20 @@ int wcsbth_pass1( - int ialt, icol, mask, ncol; + return status; +@@ -3091,8 +3056,8 @@ jmp_buf wcsbth_abort_jmp_env; + } + + if (ipass++ < npass) { +- wcsbth_hdr = header; +- wcsbth_nkeyrec = nkeyrec; ++ yyextra->hdr = header; ++ yyextra->nkeyrec = nkeyrec; + keyrec = header; + *nreject = 0; + +@@ -3139,6 +3104,36 @@ jmp_buf wcsbth_abort_jmp_env; + %% + /*---------------------------------------------------------------------------- ++* External interface to the scanner. ++*---------------------------------------------------------------------------*/ ++ ++int wcsbth( ++ char *header, ++ int nkeyrec, ++ int relax, ++ int ctrl, ++ int keysel, ++ int *colsel, ++ int *nreject, ++ int *nwcs, ++ struct wcsprm **wcs) ++ ++{ ++ // Function prototypes. ++ int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner); ++ int yylex_destroy(yyscan_t yyscanner); ++ ++ struct wcsbth_extra extra; ++ yyscan_t yyscanner; ++ yylex_init_extra(&extra, &yyscanner); ++ int status = wcsbth_scanner(header, nkeyrec, relax, ctrl, keysel, colsel, ++ nreject, nwcs, wcs, yyscanner); ++ yylex_destroy(yyscanner); ++ ++ return status; ++} ++ ++/*---------------------------------------------------------------------------- + * Perform first-pass tasks: + * + * 1) Count the number of coordinate axes in each of the 27 possible alternate +@@ -3175,23 +3170,21 @@ int wcsbth_pass1( + struct wcsbth_alts *alts) + + { +- int ialt, icol, mask, ncol; +- if (a == 0) { - /* Keywords such as DATE-OBS go along for the ride. */ + // Keywords such as DATE-OBS go along for the ride. return 0; } - ncol = alts->ncol; +- ncol = alts->ncol; ++ int ncol = alts->ncol; - /* Do we need to allocate memory for alts? */ + // Do we need to allocate memory for alts? @@ -26917,7 +31161,14 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l ncol = 999; } } -@@ -3210,7 +3207,7 @@ int wcsbth_pass1( +@@ -3204,13 +3197,13 @@ int wcsbth_pass1( + if (alts->npv) free(alts->npv); + if (alts->nps) free(alts->nps); + if (alts->pixlist) free(alts->pixlist); +- return 2; ++ return WCSHDRERR_MEMORY; + } + alts->ncol = ncol; } else if (n > ncol || k > ncol) { @@ -26926,16 +31177,30 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l ncol = 999; if (!(alts->arridx = realloc(alts->arridx, 27*(1 + ncol)*sizeof(short int))) || -@@ -3227,7 +3224,7 @@ int wcsbth_pass1( - return 2; +@@ -3224,12 +3217,12 @@ int wcsbth_pass1( + if (alts->npv) free(alts->npv); + if (alts->nps) free(alts->nps); + if (alts->pixlist) free(alts->pixlist); +- return 2; ++ return WCSHDRERR_MEMORY; } - /* Since realloc() doesn't initialize the extra memory. */ +- for (icol = (1 + alts->ncol); icol < (1 + ncol); icol++) { +- for (ialt = 0; ialt < 27; ialt++) { + // Since realloc() doesn't initialize the extra memory. - for (icol = (1 + alts->ncol); icol < (1 + ncol); icol++) { - for (ialt = 0; ialt < 27; ialt++) { ++ for (int icol = (1 + alts->ncol); icol < (1 + ncol); icol++) { ++ for (int ialt = 0; ialt < 27; ialt++) { alts->arridx[icol][ialt] = 0; -@@ -3245,18 +3242,18 @@ int wcsbth_pass1( + alts->npv[icol][ialt] = 0; + alts->nps[icol][ialt] = 0; +@@ -3240,23 +3233,23 @@ int wcsbth_pass1( + alts->ncol = ncol; + } + +- ialt = 0; ++ int ialt = 0; + if (a != ' ') { ialt = a - 'A' + 1; } @@ -26959,7 +31224,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l if (alts->arridx[n][ialt] < i) { alts->arridx[n][ialt] = i; } -@@ -3273,17 +3270,17 @@ int wcsbth_pass1( +@@ -3273,17 +3266,17 @@ int wcsbth_pass1( } } @@ -26970,7 +31235,8 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l + // image arrays, never contribute to recognizing a table column as a pixel + // list axis. A PIXLIST keytype is required for that. if (keytype == PIXLIST) { - mask = 1 << ialt; +- mask = 1 << ialt; ++ int mask = 1 << ialt; - /* n > 0 for PIXLIST keytypes. */ + // n > 0 for PIXLIST keytypes. @@ -26982,16 +31248,34 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l alts->pixlist[0] |= mask; if (ptype == 'v') { -@@ -3320,7 +3317,7 @@ int wcsbth_init1( +@@ -3311,22 +3304,20 @@ int wcsbth_init1( + struct wcsprm **wcs) + + { +- int ialt, icol, inherit[27], ix, mask, ncol, npsmax, npvmax, status = 0; +- struct wcsprm *wcsp; +- ++ int status = 0; + + if (alts->arridx == 0x0) { + *nwcs = 0; return 0; } - /* Determine the number of axes in each pixel list representation. */ +- ncol = alts->ncol; + // Determine the number of axes in each pixel list representation. - ncol = alts->ncol; ++ int ialt, mask, ncol = alts->ncol; for (ialt = 0, mask = 1; ialt < 27; ialt++, mask <<= 1) { alts->pixidx[ialt] = 0; -@@ -3334,7 +3331,7 @@ int wcsbth_init1( + + if (alts->pixlist[0] | mask) { +- for (icol = 1; icol <= ncol; icol++) { ++ for (int icol = 1; icol <= ncol; icol++) { + if (alts->pixlist[icol] & mask) { + alts->pixidx[ialt]++; + } +@@ -3334,18 +3325,19 @@ int wcsbth_init1( } } @@ -26999,10 +31283,13 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l + // Find the total number of coordinate representations. *nwcs = 0; alts->imgherit = 0; - for (ialt = 0; ialt < 27; ialt++) { -@@ -3342,10 +3339,10 @@ int wcsbth_init1( +- for (ialt = 0; ialt < 27; ialt++) { ++ int inherit[27]; ++ for (int ialt = 0; ialt < 27; ialt++) { + inherit[ialt] = 0; - for (icol = 1; icol <= ncol; icol++) { +- for (icol = 1; icol <= ncol; icol++) { ++ for (int icol = 1; icol <= ncol; icol++) { if (alts->arridx[icol][ialt] < 0) { - /* No BIMGARR keytype but there's at least one BINTAB. */ + // No BIMGARR keytype but there's at least one BINTAB. @@ -27014,7 +31301,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l alts->arridx[icol][ialt] = alts->arridx[0][ialt]; } else { alts->arridx[icol][ialt] = 0; -@@ -3354,11 +3351,11 @@ int wcsbth_init1( +@@ -3354,11 +3346,11 @@ int wcsbth_init1( if (alts->arridx[icol][ialt]) { if (alts->arridx[0][ialt]) { @@ -27028,7 +31315,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l alts->arridx[icol][ialt] = alts->arridx[0][ialt]; } } -@@ -3367,10 +3364,10 @@ int wcsbth_init1( +@@ -3367,10 +3359,10 @@ int wcsbth_init1( } } @@ -27041,7 +31328,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l alts->arridx[0][ialt] = 0; alts->imgherit = 1; } else if (alts->arridx[0][ialt] > 0) { -@@ -3378,7 +3375,7 @@ int wcsbth_init1( +@@ -3378,7 +3370,7 @@ int wcsbth_init1( } } @@ -27050,31 +31337,39 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l if (alts->pixidx[ialt]) { (*nwcs)++; } -@@ -3386,19 +3383,19 @@ int wcsbth_init1( +@@ -3386,95 +3378,95 @@ int wcsbth_init1( if (*nwcs) { - /* Allocate memory for the required number of wcsprm structs. */ + // Allocate memory for the required number of wcsprm structs. if (!(*wcs = calloc(*nwcs, sizeof(struct wcsprm)))) { - return 2; +- return 2; ++ return WCSHDRERR_MEMORY; } - /* Initialize each wcsprm struct. */ +- wcsp = *wcs; + // Initialize each wcsprm struct. - wcsp = *wcs; ++ struct wcsprm *wcsp = *wcs; *nwcs = 0; - for (icol = 0; icol <= ncol; icol++) { - for (ialt = 0; ialt < 27; ialt++) { +- for (icol = 0; icol <= ncol; icol++) { +- for (ialt = 0; ialt < 27; ialt++) { ++ for (int icol = 0; icol <= ncol; icol++) { ++ for (int ialt = 0; ialt < 27; ialt++) { if (alts->arridx[icol][ialt] > 0) { - /* Image-header representations that are not for inheritance - (icol == 0) or binary table image array representations. */ + // Image-header representations that are not for inheritance + // (icol == 0) or binary table image array representations. wcsp->flag = -1; - npvmax = alts->npv[icol][ialt]; - npsmax = alts->nps[icol][ialt]; -@@ -3408,29 +3405,29 @@ int wcsbth_init1( +- npvmax = alts->npv[icol][ialt]; +- npsmax = alts->nps[icol][ialt]; ++ int npvmax = alts->npv[icol][ialt]; ++ int npsmax = alts->nps[icol][ialt]; + if ((status = wcsinit(1, (int)(alts->arridx[icol][ialt]), wcsp, + npvmax, npsmax, -1))) { + wcsvfree(nwcs, wcs); break; } @@ -27110,16 +31405,21 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l alts->arridx[icol][ialt] = -1; } } -@@ -3438,7 +3435,7 @@ int wcsbth_init1( + } - for (ialt = 0; ialt < 27; ialt++) { +- for (ialt = 0; ialt < 27; ialt++) { ++ for (int ialt = 0; ialt < 27; ialt++) { if (alts->pixidx[ialt]) { - /* Pixel lists representations. */ + // Pixel lists representations. wcsp->flag = -1; - npvmax = alts->pixnpv[ialt]; - npsmax = alts->pixnps[ialt]; -@@ -3448,19 +3445,19 @@ int wcsbth_init1( +- npvmax = alts->pixnpv[ialt]; +- npsmax = alts->pixnps[ialt]; ++ int npvmax = alts->pixnpv[ialt]; ++ int npsmax = alts->pixnps[ialt]; + if ((status = wcsinit(1, (int)(alts->pixidx[ialt]), wcsp, npvmax, + npsmax, -1))) { + wcsvfree(nwcs, wcs); break; } @@ -27138,11 +31438,12 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l } - /* Record the pixel list column numbers. */ +- mask = (1 << ialt); + // Record the pixel list column numbers. - mask = (1 << ialt); ++ int icol, ix, mask = (1 << ialt); for (icol = 1, ix = 0; icol <= ncol; icol++) { if (alts->pixlist[icol] & mask) { -@@ -3468,13 +3465,13 @@ int wcsbth_init1( + wcsp->colax[ix++] = icol; } } @@ -27158,9 +31459,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l alts->pixidx[ialt] = -1; } } -@@ -3504,22 +3501,22 @@ struct wcsprm *wcsbth_idx( +@@ -3498,28 +3490,27 @@ struct wcsprm *wcsbth_idx( - iwcs = -1; + { + const char as[] = " ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +- int iwcs; + + if (!wcs) return 0x0; + +- iwcs = -1; ++ int iwcs = -1; for (; iwcs < 0 && alts->ialt < 27; alts->ialt++) { - /* Note that a == 0 applies to every alternate, otherwise this - loop simply determines the appropriate value of alts->ialt. */ @@ -27187,7 +31495,27 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l alts->icol = 0; } -@@ -3571,7 +3568,7 @@ int wcsbth_colax( +@@ -3544,17 +3535,14 @@ int wcsbth_colax( + char a) + + { +- int ix; +- struct wcsprm *wcsp; +- + if (!wcs) return 0; + +- wcsp = wcs; ++ struct wcsprm *wcsp = wcs; + if (a != ' ') { + wcsp += alts->pixidx[a-'A'+1]; + } + +- for (ix = 0; ix < wcsp->naxis; ix++) { ++ for (int ix = 0; ix < wcsp->naxis; ix++) { + if (wcsp->colax[ix] == n) { + return ++ix; + } +@@ -3571,7 +3559,7 @@ int wcsbth_colax( int wcsbth_jdref(double *mjdref, const double *jdref) { @@ -27196,7 +31524,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l if (undefined(mjdref[0] && undefined(mjdref[1]))) { mjdref[0] = jdref[0] - 2400000.0; mjdref[1] = jdref[1] - 0.5; -@@ -3588,7 +3585,7 @@ int wcsbth_jdref(double *mjdref, const d +@@ -3588,7 +3576,7 @@ int wcsbth_jdref(double *mjdref, const d int wcsbth_jdrefi(double *mjdref, const double *jdrefi) { @@ -27205,7 +31533,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l if (undefined(mjdref[0])) { mjdref[0] = *jdrefi - 2400000.5; } -@@ -3600,7 +3597,7 @@ int wcsbth_jdrefi(double *mjdref, const +@@ -3600,7 +3588,7 @@ int wcsbth_jdrefi(double *mjdref, const int wcsbth_jdreff(double *mjdref, const double *jdreff) { @@ -27214,7 +31542,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l if (undefined(mjdref[1])) { mjdref[1] = *jdreff; } -@@ -3616,7 +3613,7 @@ int wcsbth_jdreff(double *mjdref, const +@@ -3616,7 +3604,7 @@ int wcsbth_jdreff(double *mjdref, const int wcsbth_epoch(double *equinox, const double *epoch) { @@ -27223,37 +31551,52 @@ Index: astropy-4.2/cextern/wcslib/C/wcsbth.l if (undefined(*equinox)) { *equinox = *epoch; } -@@ -3634,9 +3631,9 @@ int wcsbth_vsource(double *zsource, cons +@@ -3632,12 +3620,12 @@ int wcsbth_epoch(double *equinox, const + int wcsbth_vsource(double *zsource, const double *vsource) + { - double beta, c = 299792458.0; +- double beta, c = 299792458.0; ++ const double c = 299792458.0; - /* If ZSOURCEa is currently undefined then set it from VSOURCEa. */ + // If ZSOURCEa is currently undefined then set it from VSOURCEa. if (undefined(*zsource)) { - /* Convert relativistic Doppler velocity to redshift. */ +- beta = *vsource/c; + // Convert relativistic Doppler velocity to redshift. - beta = *vsource/c; ++ double beta = *vsource/c; *zsource = (1.0 + beta)/sqrt(1.0 - beta*beta) - 1.0; } -@@ -3674,7 +3671,7 @@ int wcsbth_final( + +@@ -3666,15 +3654,14 @@ int wcsbth_final( + struct wcsprm **wcs) + + { +- int ialt, status; +- + if (alts->arridx) free(alts->arridx); + if (alts->npv) free(alts->npv); + if (alts->nps) free(alts->nps); if (alts->pixlist) free(alts->pixlist); - for (ialt = 0; ialt < *nwcs; ialt++) { +- for (ialt = 0; ialt < *nwcs; ialt++) { - /* Interpret -TAB header keywords. */ ++ for (int ialt = 0; ialt < *nwcs; ialt++) { + // Interpret -TAB header keywords. ++ int status; if ((status = wcstab(*wcs+ialt))) { wcsvfree(nwcs, wcs); return status; -Index: astropy-4.2/cextern/wcslib/C/wcserr.c +Index: astropy-4.2.1/cextern/wcslib/C/wcserr.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcserr.c -+++ astropy-4.2/cextern/wcslib/C/wcserr.c +--- astropy-4.2.1.orig/cextern/wcslib/C/wcserr.c ++++ astropy-4.2.1/cextern/wcslib/C/wcserr.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -27268,7 +31611,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcserr.c Module author: Michael Droettboom http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcserr.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcserr.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcserr.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -27281,16 +31624,39 @@ Index: astropy-4.2/cextern/wcslib/C/wcserr.c int wcserr_enable(int enable) -@@ -44,7 +41,7 @@ int wcserr_enable(int enable) +@@ -44,7 +41,30 @@ int wcserr_enable(int enable) return wcserr_enabled = (enable ? 1 : 0); } -/*--------------------------------------------------------------------------*/ ++//---------------------------------------------------------------------------- ++ ++int wcserr_size(const struct wcserr *err, int sizes[2]) ++ ++{ ++ if (err == 0x0) { ++ sizes[0] = sizes[1] = 0; ++ return 0; ++ } ++ ++ // Base size, in bytes. ++ sizes[0] = sizeof(struct wcserr); ++ ++ // Total size of allocated memory, in bytes. ++ sizes[1] = 0; ++ ++ if (err->msg) { ++ sizes[1] += strlen(err->msg) + 1; ++ } ++ ++ return 0; ++} ++ +//---------------------------------------------------------------------------- int wcserr_prt(const struct wcserr *err, const char *prefix) -@@ -66,7 +63,7 @@ int wcserr_prt(const struct wcserr *err, +@@ -66,7 +86,7 @@ int wcserr_prt(const struct wcserr *err, prefix, err->status, err->function, err->line_no, err->file, prefix, err->msg); } else { @@ -27299,7 +31665,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcserr.c wcsprintf("%sINFORMATIVE message from %s() at line %d of file " "%s:\n%s%s.\n", prefix, err->function, err->line_no, err->file, prefix, err->msg); -@@ -76,7 +73,7 @@ int wcserr_prt(const struct wcserr *err, +@@ -76,7 +96,7 @@ int wcserr_prt(const struct wcserr *err, return 0; } @@ -27308,7 +31674,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcserr.c int wcserr_clear(struct wcserr **errp) -@@ -92,7 +89,7 @@ int wcserr_clear(struct wcserr **errp) +@@ -92,7 +112,7 @@ int wcserr_clear(struct wcserr **errp) return 0; } @@ -27317,7 +31683,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcserr.c int wcserr_set( struct wcserr **errp, -@@ -130,7 +127,7 @@ int wcserr_set( +@@ -130,7 +150,7 @@ int wcserr_set( err->line_no = line_no; err->msg = 0x0; @@ -27326,7 +31692,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcserr.c va_start(argp, format); msglen = vsnprintf(0x0, 0, format, argp) + 1; va_end(argp); -@@ -140,7 +137,7 @@ int wcserr_set( +@@ -140,7 +160,7 @@ int wcserr_set( return status; } @@ -27335,7 +31701,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcserr.c va_start(argp, format); msglen = vsnprintf(err->msg, msglen, format, argp); va_end(argp); -@@ -153,7 +150,7 @@ int wcserr_set( +@@ -153,7 +173,7 @@ int wcserr_set( return status; } @@ -27344,16 +31710,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcserr.c int wcserr_copy(const struct wcserr *src, struct wcserr *dst) -Index: astropy-4.2/cextern/wcslib/C/wcserr.h +Index: astropy-4.2.1/cextern/wcslib/C/wcserr.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcserr.h -+++ astropy-4.2/cextern/wcslib/C/wcserr.h +--- astropy-4.2.1.orig/cextern/wcslib/C/wcserr.h ++++ astropy-4.2.1/cextern/wcslib/C/wcserr.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -27368,15 +31734,54 @@ Index: astropy-4.2/cextern/wcslib/C/wcserr.h Module author: Michael Droettboom http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcserr.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcserr.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcserr.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * -@@ -221,14 +218,14 @@ extern "C" { +@@ -34,7 +31,7 @@ + * ------------------------------ + * Most of the structs in WCSLIB contain a pointer to a wcserr struct as a + * member. Functions in WCSLIB that return an error status code can also +-* allocate and set a detailed error message in this struct which also ++* allocate and set a detailed error message in this struct, which also + * identifies the function, source file, and line number where the error + * occurred. + * +@@ -97,6 +94,29 @@ + * 1: Error messaging is enabled. + * + * ++* wcserr_size() - Compute the size of a wcserr struct ++* --------------------------------------------------- ++* wcserr_size() computes the full size of a wcserr struct, including allocated ++* memory. ++* ++* Given: ++* err const struct wcserr* ++* The error object. ++* ++* If NULL, the base size of the struct and the allocated ++* size are both set to zero. ++* ++* Returned: ++* sizes int[2] The first element is the base size of the struct as ++* returned by sizeof(struct wcserr). The second element ++* is the total allocated size of the message buffer, in ++* bytes. ++* ++* Function return value: ++* int Status return value: ++* 0: Success. ++* ++* + * wcserr_prt() - Print a wcserr struct + * ------------------------------------ + * wcserr_prt() prints the error message (if any) contained in a wcserr struct. +@@ -221,35 +241,37 @@ extern "C" { #endif struct wcserr { @@ -27397,7 +31802,11 @@ Index: astropy-4.2/cextern/wcslib/C/wcserr.h #define ERRLEN (sizeof(struct wcserr)/sizeof(int)) int wcserr_enable(int enable); -@@ -238,18 +235,18 @@ int wcserr_prt(const struct wcserr *err, + ++int wcserr_size(const struct wcserr *err, int sizes[2]); ++ + int wcserr_prt(const struct wcserr *err, const char *prefix); + int wcserr_clear(struct wcserr **err); @@ -27419,16 +31828,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcserr.h -#endif /* WSCLIB_WCSERR */ +#endif // WSCLIB_WCSERR -Index: astropy-4.2/cextern/wcslib/C/wcsfix.c +Index: astropy-4.2.1/cextern/wcslib/C/wcsfix.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcsfix.c -+++ astropy-4.2/cextern/wcslib/C/wcsfix.c +--- astropy-4.2.1.orig/cextern/wcslib/C/wcsfix.c ++++ astropy-4.2.1/cextern/wcslib/C/wcsfix.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -27442,11 +31851,30 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsfix.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcsfix.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcsfix.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include -@@ -42,10 +39,10 @@ +@@ -30,22 +27,24 @@ + #include + #include + +-#include "wcserr.h" +-#include "wcsmath.h" +-#include "wcstrig.h" +-#include "wcsutil.h" + #include "lin.h" + #include "sph.h" ++#include "tab.h" + #include "wcs.h" +-#include "wcsunits.h" ++#include "wcserr.h" + #include "wcsfix.h" ++#include "wcsmath.h" ++#include "wcstrig.h" ++#include "wcsunits.h" ++#include "wcsutil.h" ++#include "wtbarr.h" extern const int WCSSET; @@ -27459,7 +31887,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c const char *wcsfix_errmsg[] = { "Success", "Null wcsprm pointer passed", -@@ -59,36 +56,36 @@ const char *wcsfix_errmsg[] = { +@@ -59,36 +58,36 @@ const char *wcsfix_errmsg[] = { "Could not determine reference pixel coordinate", "Could not determine reference pixel value"}; @@ -27518,7 +31946,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c int wcsfix(int ctrl, const int naxis[], struct wcsprm *wcs, int stat[]) -@@ -126,7 +123,7 @@ int wcsfix(int ctrl, const int naxis[], +@@ -126,7 +125,7 @@ int wcsfix(int ctrl, const int naxis[], return status; } @@ -27527,9 +31955,13 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c int wcsfixi( int ctrl, -@@ -139,20 +136,20 @@ int wcsfixi( - int ifix, status = 0; - struct wcserr err; +@@ -136,23 +135,23 @@ int wcsfixi( + struct wcserr info[]) + + { +- int ifix, status = 0; +- struct wcserr err; ++ int status = 0; - /* Handling the status values returned from the sub-fixers is trickier than - it might seem, especially considering that wcs->err may contain an error @@ -27551,15 +31983,17 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c + // To get informative messages from spcfix() it must precede celfix() and + // cylfix(). The latter call wcsset() which also translates AIPS-convention + // spectral axes. ++ struct wcserr err; wcserr_copy(wcs->err, &err); - for (ifix = CDFIX; ifix < NWCSFIX; ifix++) { +- for (ifix = CDFIX; ifix < NWCSFIX; ifix++) { - /* Clear (delete) wcs->err. */ ++ for (int ifix = CDFIX; ifix < NWCSFIX; ifix++) { + // Clear (delete) wcs->err. wcserr_clear(&(wcs->err)); switch (ifix) { -@@ -182,11 +179,11 @@ int wcsfixi( +@@ -182,11 +181,11 @@ int wcsfixi( } if (stat[ifix] == FIXERR_NO_CHANGE) { @@ -27573,7 +32007,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c if (wcs->err && wcs->err->status < 0) { wcserr_copy(wcs->err, info+ifix); } else { -@@ -194,17 +191,17 @@ int wcsfixi( +@@ -194,17 +193,17 @@ int wcsfixi( } } else { @@ -27594,7 +32028,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c if (err.status) { wcserr_copy(&err, wcs->err); } else { -@@ -214,7 +211,7 @@ int wcsfixi( +@@ -214,39 +213,36 @@ int wcsfixi( return status; } @@ -27603,7 +32037,10 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c int cdfix(struct wcsprm *wcs) -@@ -225,20 +222,20 @@ int cdfix(struct wcsprm *wcs) + { +- int i, k, naxis, status = FIXERR_NO_CHANGE; +- double *cd; +- if (wcs == 0x0) return FIXERR_NULL_POINTER; if ((wcs->altlin & 1) || !(wcs->altlin & 2)) { @@ -27612,22 +32049,28 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c return FIXERR_NO_CHANGE; } - naxis = wcs->naxis; - status = FIXERR_NO_CHANGE; - for (i = 0; i < naxis; i++) { +- naxis = wcs->naxis; +- status = FIXERR_NO_CHANGE; +- for (i = 0; i < naxis; i++) { - /* Row of zeros? */ +- cd = wcs->cd + i * naxis; +- for (k = 0; k < naxis; k++, cd++) { ++ int naxis = wcs->naxis; ++ int status = FIXERR_NO_CHANGE; ++ for (int i = 0; i < naxis; i++) { + // Row of zeros? - cd = wcs->cd + i * naxis; - for (k = 0; k < naxis; k++, cd++) { ++ double *cd = wcs->cd + i*naxis; ++ for (int k = 0; k < naxis; k++, cd++) { if (*cd != 0.0) goto next; } - /* Column of zeros? */ + // Column of zeros? cd = wcs->cd + i; - for (k = 0; k < naxis; k++, cd += naxis) { +- for (k = 0; k < naxis; k++, cd += naxis) { ++ for (int k = 0; k < naxis; k++, cd += naxis) { if (*cd != 0.0) goto next; -@@ -246,7 +243,7 @@ int cdfix(struct wcsprm *wcs) + } cd = wcs->cd + i * (naxis + 1); *cd = 1.0; @@ -27636,7 +32079,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c next: ; } -@@ -254,7 +251,7 @@ next: ; +@@ -254,13 +250,12 @@ next: ; return status; } @@ -27645,7 +32088,29 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c static int parse_date(const char *buf, int *hour, int *minute, double *sec) -@@ -300,11 +297,11 @@ int datfix(struct wcsprm *wcs) + { + char ctmp[72]; +- + if (sscanf(buf, "%2d:%2d:%s", hour, minute, ctmp) < 3 || + wcsutil_str2double(ctmp, sec)) { + return 1; +@@ -274,7 +269,6 @@ static void write_date(char *buf, int ho + + { + char ctmp[32]; +- + wcsutil_double2str(ctmp, "%04.1f", sec); + sprintf(buf, "T%.2d:%.2d:%s", hour, minute, ctmp); + } +@@ -284,7 +278,6 @@ static char *newline(char **cp) + + { + size_t k; +- + if ((k = strlen(*cp))) { + *cp += k; + strcat(*cp, ".\n"); +@@ -300,32 +293,34 @@ int datfix(struct wcsprm *wcs) { static const char *function = "datfix"; @@ -27659,21 +32124,46 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c const double djy = 365.25; const double dty = 365.242198781; -@@ -322,10 +319,10 @@ int datfix(struct wcsprm *wcs) - status = FIXERR_NO_CHANGE; +- const char *dateid; +- char *cp, *date, infomsg[512], orig_date[72]; +- int day, dd, hour = 0, i, jd, minute = 0, month, msec, n4, status, year; +- double bepoch, jepoch, mjd[2], mjdsum, mjdtmp, sec = 0.0, t, *wcsmjd; +- struct wcserr **err; ++ int day, hour = 0, minute = 0, month, year; ++ double sec = 0.0; - for (i = 0; i < 5; i++) { + if (wcs == 0x0) return FIXERR_NULL_POINTER; +- err = &(wcs->err); ++ struct wcserr **err = &(wcs->err); + +- cp = infomsg; ++ char infomsg[512]; ++ char *cp = infomsg; + *cp = '\0'; +- status = FIXERR_NO_CHANGE; + +- for (i = 0; i < 5; i++) { - /* MJDREF is split into integer and fractional parts, wheres MJDOBS and - the rest are a single value. */ ++ int status = FIXERR_NO_CHANGE; ++ ++ for (int i = 0; i < 5; i++) { + // MJDREF is split into integer and fractional parts, wheres MJDOBS and + // the rest are a single value. ++ const char *dateid; ++ char *date; ++ double *wcsmjd; if (i == 0) { - /* Note, DATEREF and MJDREF, not DATE-REF and MJD-REF (sigh). */ + // Note, DATEREF and MJDREF, not DATE-REF and MJD-REF (sigh). dateid = "REF"; date = wcs->dateref; wcsmjd = wcs->mjdref; -@@ -350,10 +347,10 @@ int datfix(struct wcsprm *wcs) +@@ -347,55 +342,59 @@ int datfix(struct wcsprm *wcs) + wcsmjd = &(wcs->mjdend); + } + ++ char orig_date[72]; strncpy(orig_date, date, 72); if (date[0] == '\0') { @@ -27686,12 +32176,13 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c if (!undefined(wcs->jepoch)) { *wcsmjd = mjd2000 + (wcs->jepoch - 2000.0)*djy; sprintf(newline(&cp), "Set MJD-OBS to %.6f from JEPOCH", *wcsmjd); -@@ -362,25 +359,27 @@ int datfix(struct wcsprm *wcs) ++ if (status == FIXERR_NO_CHANGE) status = FIXERR_SUCCESS; + + } else if (!undefined(wcs->bepoch)) { *wcsmjd = mjd1900 + (wcs->bepoch - 1900.0)*dty; sprintf(newline(&cp), "Set MJD-OBS to %.6f from BEPOCH", *wcsmjd); ++ if (status == FIXERR_NO_CHANGE) status = FIXERR_SUCCESS; } -+ -+ if (status == FIXERR_NO_CHANGE) status = FIXERR_SUCCESS; } if (undefined(*wcsmjd)) { @@ -27701,6 +32192,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c } else { - /* Calendar date from MJD, with allowance for MJD < 0. */ + // Calendar date from MJD, with allowance for MJD < 0. ++ double mjd[2], t; if (i == 0) { - /* MJDREF is already split into integer and fractional parts. */ + // MJDREF is already split into integer and fractional parts. @@ -27719,7 +32211,17 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c mjd[0] = floor(*wcsmjd); mjd[1] = *wcsmjd - mjd[0]; } -@@ -395,7 +394,7 @@ int datfix(struct wcsprm *wcs) + +- jd = 2400001 + (int)mjd[0]; ++ int jd = 2400001 + (int)mjd[0]; + +- n4 = 4*(jd + ((2*((4*jd - 17918)/146097)*3)/4 + 1)/2 - 37); +- dd = 10*(((n4-237)%1461)/4) + 5; ++ int n4 = 4*(jd + ((2*((4*jd - 17918)/146097)*3)/4 + 1)/2 - 37); ++ int dd = 10*(((n4-237)%1461)/4) + 5; + + year = n4/1461 - 4712; + month = (2 + dd/306)%12 + 1; day = (dd%306)/10 + 1; sprintf(date, "%.4d-%.2d-%.2d", year, month, day); @@ -27728,7 +32230,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c if (0.0 < (t = mjd[1])) { t *= 24.0; hour = (int)t; -@@ -403,7 +402,7 @@ int datfix(struct wcsprm *wcs) +@@ -403,15 +402,15 @@ int datfix(struct wcsprm *wcs) minute = (int)t; sec = 60.0 * (t - minute); @@ -27737,8 +32239,9 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c dd = 60000*(60*hour + minute) + (int)(1000*(sec+0.0005)); hour = dd / 3600000; dd -= 3600000 * hour; -@@ -411,7 +410,7 @@ int datfix(struct wcsprm *wcs) - msec = dd - 60000 * minute; + minute = dd / 60000; +- msec = dd - 60000 * minute; ++ int msec = dd - 60000 * minute; sprintf(date+10, "T%.2d:%.2d:%.2d", hour, minute, msec/1000); - /* Write fractions of a second only if non-zero. */ @@ -27809,7 +32312,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c status = FIXERR_BAD_PARAM; sprintf(newline(&cp), "Invalid DATE%s format '%s'", dateid, date); continue; -@@ -512,11 +511,11 @@ int datfix(struct wcsprm *wcs) +@@ -512,17 +511,18 @@ int datfix(struct wcsprm *wcs) if (year < 100) year += 1900; @@ -27820,10 +32323,18 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c - /* Compute MJD. */ + // Compute MJD. ++ double mjd[2]; mjd[0] = (double)((1461*(year - (12-month)/10 + 4712))/4 + (306*((month+9)%12) + 5)/10 - (3*((year - (12-month)/10 + 4900)/100))/4 -@@ -534,8 +533,10 @@ int datfix(struct wcsprm *wcs) + + day - 2399904); + mjd[1] = (hour + (minute + sec/60.0)/60.0)/24.0; +- mjdsum = mjd[0] + mjd[1]; ++ double mjdsum = mjd[0] + mjd[1]; + + if (undefined(*wcsmjd)) { + if (i == 0) { +@@ -534,8 +534,11 @@ int datfix(struct wcsprm *wcs) sprintf(newline(&cp), "Set MJD%s to %.6f from DATE%s", dateid, mjdsum, dateid); @@ -27832,16 +32343,18 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c } else { - /* Check for consistency. */ + // Check for consistency. ++ double mjdtmp; if (i == 0) { mjdtmp = wcsmjd[0] + wcsmjd[1]; } else { -@@ -552,21 +553,21 @@ int datfix(struct wcsprm *wcs) +@@ -552,21 +555,21 @@ int datfix(struct wcsprm *wcs) if (i == 1) { if (!undefined(wcs->jepoch)) { - /* Check consistency of JEPOCH. */ +- jepoch = 2000.0 + (*wcsmjd - mjd2000) / djy; + // Check consistency of JEPOCH. - jepoch = 2000.0 + (*wcsmjd - mjd2000) / djy; ++ double jepoch = 2000.0 + (*wcsmjd - mjd2000) / djy; if (0.000002 < fabs(jepoch - wcs->jepoch)) { - /* Informational only, no error. */ @@ -27852,8 +32365,9 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c if (!undefined(wcs->bepoch)) { - /* Check consistency of BEPOCH. */ +- bepoch = 1900.0 + (*wcsmjd - mjd1900) / dty; + // Check consistency of BEPOCH. - bepoch = 1900.0 + (*wcsmjd - mjd1900) / dty; ++ double bepoch = 1900.0 + (*wcsmjd - mjd1900) / dty; if (0.000002 < fabs(bepoch - wcs->bepoch)) { - /* Informational only, no error. */ @@ -27861,7 +32375,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c sprintf(newline(&cp), "BEPOCH is inconsistent with DATE-OBS"); } } -@@ -582,7 +583,7 @@ int datfix(struct wcsprm *wcs) +@@ -582,7 +585,7 @@ int datfix(struct wcsprm *wcs) orig_date, date); } @@ -27870,7 +32384,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c } } -@@ -593,14 +594,14 @@ int datfix(struct wcsprm *wcs) +@@ -593,37 +596,33 @@ int datfix(struct wcsprm *wcs) return status; } @@ -27883,20 +32397,32 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c static const char *function = "obsfix"; - /* IAU(1976) ellipsoid (as prescribed by WCS Paper VII). */ +- const double a = 6378140.0, f = 1.0 / 298.2577; + // IAU(1976) ellipsoid (as prescribed by WCS Paper VII). - const double a = 6378140.0, f = 1.0 / 298.2577; ++ const double a = 6378140.0; ++ const double f = 1.0 / 298.2577; const double e2 = (2.0 - f)*f; -@@ -614,7 +615,7 @@ int obsfix(int ctrl, struct wcsprm *wcs) +- char *cp, infomsg[256]; +- int havelbh = 7, havexyz = 7, i, status; +- size_t k; +- double coslat, coslng, d, hgt, lat, lng, n, r2, rho, sinlat, sinlng, x, y, +- z, zeta; +- struct wcserr **err; +- if (wcs == 0x0) return FIXERR_NULL_POINTER; - err = &(wcs->err); +- err = &(wcs->err); ++ struct wcserr **err = &(wcs->err); - /* Set masks for checking partially-defined coordinate triplets. */ + // Set masks for checking partially-defined coordinate triplets. ++ int havexyz = 7; havexyz -= 1*undefined(wcs->obsgeo[0]); havexyz -= 2*undefined(wcs->obsgeo[1]); havexyz -= 4*undefined(wcs->obsgeo[2]); -@@ -623,7 +624,7 @@ int obsfix(int ctrl, struct wcsprm *wcs) ++ int havelbh = 7; + havelbh -= 1*undefined(wcs->obsgeo[3]); + havelbh -= 2*undefined(wcs->obsgeo[4]); havelbh -= 4*undefined(wcs->obsgeo[5]); if (ctrl == 2) { @@ -27905,27 +32431,44 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c if (0 < havexyz && havexyz < 7) { return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM), "Partially undefined Cartesian coordinate triplet"); -@@ -648,7 +649,7 @@ int obsfix(int ctrl, struct wcsprm *wcs) - status = FIXERR_NO_CHANGE; +@@ -644,24 +643,29 @@ int obsfix(int ctrl, struct wcsprm *wcs) + } + ++ char infomsg[256]; + infomsg[0] = '\0'; +- status = FIXERR_NO_CHANGE; + ++ int status = FIXERR_NO_CHANGE; ++ ++ size_t k; ++ double x, y, z; if (havelbh == 7) { - /* Compute (x,y,z) from (lng,lat,hgt). */ + // Compute (x,y,z) from (lng,lat,hgt). ++ double coslat, coslng, sinlat, sinlng; sincosd(wcs->obsgeo[3], &sinlng, &coslng); sincosd(wcs->obsgeo[4], &sinlat, &coslat); - n = a / sqrt(1.0 - e2*sinlat*sinlat); -@@ -659,8 +660,8 @@ int obsfix(int ctrl, struct wcsprm *wcs) +- n = a / sqrt(1.0 - e2*sinlat*sinlat); +- rho = n + wcs->obsgeo[5]; ++ double n = a / sqrt(1.0 - e2*sinlat*sinlat); ++ double rho = n + wcs->obsgeo[5]; + + x = rho*coslng*coslat; + y = rho*sinlng*coslat; z = (rho - n*e2)*sinlat; if (havexyz < 7) { - /* One or more of the Cartesian elements was undefined. */ - status = 0; +- cp = infomsg; + // One or more of the Cartesian elements was undefined. + status = FIXERR_SUCCESS; - cp = infomsg; ++ char *cp = infomsg; if (ctrl == 1 || !(havexyz & 1)) { -@@ -695,19 +696,19 @@ int obsfix(int ctrl, struct wcsprm *wcs) + wcs->obsgeo[0] = x; +@@ -695,21 +699,22 @@ int obsfix(int ctrl, struct wcsprm *wcs) wcserr_set(WCSERR_SET(FIXERR_OBSGEO_FIX), infomsg); if (havexyz == 0) { @@ -27941,25 +32484,41 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c x = wcs->obsgeo[0]; y = wcs->obsgeo[1]; z = wcs->obsgeo[2]; - r2 = x*x + y*y; +- r2 = x*x + y*y; ++ double r2 = x*x + y*y; - /* Iterate over the value of zeta. */ +- zeta = z; +- for (i = 0; i < 4; i++) { + // Iterate over the value of zeta. - zeta = z; - for (i = 0; i < 4; i++) { ++ double coslat, coslng, sinlat, sinlng; ++ double n, rho, zeta = z; ++ for (int i = 0; i < 4; i++) { rho = sqrt(r2 + zeta*zeta); -@@ -722,8 +723,8 @@ int obsfix(int ctrl, struct wcsprm *wcs) - hgt = rho - n; + sinlat = zeta / rho; + n = a / sqrt(1.0 - e2*sinlat*sinlat); +@@ -717,14 +722,14 @@ int obsfix(int ctrl, struct wcsprm *wcs) + zeta = z / (1.0 - n*e2/rho); + } + +- lng = atan2d(y, x); +- lat = asind(sinlat); +- hgt = rho - n; ++ double lng = atan2d(y, x); ++ double lat = asind(sinlat); ++ double hgt = rho - n; if (havelbh < 7) { - /* One or more of the Geodetic elements was undefined. */ - status = 0; +- cp = infomsg; + // One or more of the Geodetic elements was undefined. + status = FIXERR_SUCCESS; - cp = infomsg; ++ char *cp = infomsg; if (ctrl == 1 || !(havelbh & 1)) { -@@ -757,12 +758,12 @@ int obsfix(int ctrl, struct wcsprm *wcs) + wcs->obsgeo[3] = lng; +@@ -757,12 +762,12 @@ int obsfix(int ctrl, struct wcsprm *wcs) wcserr_set(WCSERR_SET(FIXERR_OBSGEO_FIX), infomsg); if (havelbh == 0) { @@ -27974,16 +32533,18 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c sincosd(wcs->obsgeo[3], &sinlng, &coslng); sincosd(wcs->obsgeo[4], &sinlat, &coslat); n = a / sqrt(1.0 - e2*sinlat*sinlat); -@@ -778,7 +779,7 @@ int obsfix(int ctrl, struct wcsprm *wcs) +@@ -778,8 +783,8 @@ int obsfix(int ctrl, struct wcsprm *wcs) } - /* Check consistency. */ +- r2 = 0.0; + // Check consistency. - r2 = 0.0; ++ double d, r2 = 0.0; d = wcs->obsgeo[0] - x; r2 += d*d; -@@ -797,7 +798,7 @@ int obsfix(int ctrl, struct wcsprm *wcs) + d = wcs->obsgeo[1] - y; +@@ -797,30 +802,30 @@ int obsfix(int ctrl, struct wcsprm *wcs) } @@ -27992,13 +32553,46 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c int unitfix(int ctrl, struct wcsprm *wcs) -@@ -829,18 +830,18 @@ int unitfix(int ctrl, struct wcsprm *wcs + { + const char *function = "unitfix"; + +- char orig_unit[72], msg[512], msgtmp[192]; +- int i, result, status = FIXERR_NO_CHANGE; +- size_t msglen; +- struct wcserr **err; +- + if (wcs == 0x0) return FIXERR_NULL_POINTER; +- err = &(wcs->err); ++ struct wcserr **err = &(wcs->err); + ++ int status = FIXERR_NO_CHANGE; ++ ++ char msg[512]; + strncpy(msg, "Changed units:", 512); + +- for (i = 0; i < wcs->naxis; i++) { ++ for (int i = 0; i < wcs->naxis; i++) { ++ char orig_unit[72]; + strncpy(orig_unit, wcs->cunit[i], 71); +- result = wcsutrne(ctrl, wcs->cunit[i], &(wcs->err)); ++ int result = wcsutrne(ctrl, wcs->cunit[i], &(wcs->err)); + if (result == 0 || result == 12) { +- msglen = strlen(msg); ++ size_t msglen = strlen(msg); + if (msglen < 511) { + wcsutil_null_fill(72, orig_unit); ++ char msgtmp[192]; + sprintf(msgtmp, "\n '%s' -> '%s',", orig_unit, wcs->cunit[i]); + strncpy(msg+msglen, msgtmp, 511-msglen); + status = FIXERR_UNITS_ALIAS; +@@ -829,52 +834,49 @@ int unitfix(int ctrl, struct wcsprm *wcs } if (status == FIXERR_UNITS_ALIAS) { - /* Chop off the trailing ", ". */ +- msglen = strlen(msg) - 2; + // Chop off the trailing ", ". - msglen = strlen(msg) - 2; ++ size_t msglen = strlen(msg) - 2; msg[msglen] = '\0'; wcserr_set(WCSERR_SET(FIXERR_UNITS_ALIAS), msg); @@ -28014,15 +32608,26 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c int spcfix(struct wcsprm *wcs) -@@ -855,26 +856,26 @@ int spcfix(struct wcsprm *wcs) - err = &(wcs->err); + { + static const char *function = "spcfix"; - for (i = 0; i < wcs->naxis; i++) { +- char ctype[9], specsys[9]; +- int i, status; +- struct wcserr **err; +- + if (wcs == 0x0) return FIXERR_NULL_POINTER; +- err = &(wcs->err); ++ struct wcserr **err = &(wcs->err); + +- for (i = 0; i < wcs->naxis; i++) { - /* Translate an AIPS-convention spectral type if present. */ -+ // Translate an AIPS-convention spectral type if present. - status = spcaips(wcs->ctype[i], wcs->velref, ctype, specsys); +- status = spcaips(wcs->ctype[i], wcs->velref, ctype, specsys); - if (status == 0) { - /* An AIPS type was found but it may match what we already have. */ ++ for (int i = 0; i < wcs->naxis; i++) { ++ // Translate an AIPS-convention spectral type if present. ++ char ctype[9], specsys[9]; ++ int status = spcaips(wcs->ctype[i], wcs->velref, ctype, specsys); + if (status == FIXERR_SUCCESS) { + // An AIPS type was found but it may match what we already have. status = FIXERR_NO_CHANGE; @@ -28050,7 +32655,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c wcserr_set(WCSERR_SET(FIXERR_SPC_UPDATE), "Changed CTYPE%d from '%s' to '%s', and SPECSYS to '%s' " "(VELREF=%d)", i+1, wcs->ctype[i], ctype, wcs->specsys, -@@ -883,23 +884,23 @@ int spcfix(struct wcsprm *wcs) +@@ -883,23 +885,23 @@ int spcfix(struct wcsprm *wcs) wcserr_set(WCSERR_SET(FIXERR_SPC_UPDATE), "Changed CTYPE%d from '%s' to '%s' (VELREF=%d)", i+1, wcs->ctype[i], ctype, wcs->velref); @@ -28079,7 +32684,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM), "Invalid parameter value: velref = %d", wcs->velref); } -@@ -908,7 +909,7 @@ int spcfix(struct wcsprm *wcs) +@@ -908,35 +910,31 @@ int spcfix(struct wcsprm *wcs) return FIXERR_NO_CHANGE; } @@ -28088,12 +32693,21 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c int celfix(struct wcsprm *wcs) -@@ -923,20 +924,20 @@ int celfix(struct wcsprm *wcs) + { + static const char *function = "celfix"; + +- int k, status; +- struct celprm *wcscel = &(wcs->cel); +- struct prjprm *wcsprj = &(wcscel->prj); +- struct wcserr **err; +- if (wcs == 0x0) return FIXERR_NULL_POINTER; - err = &(wcs->err); +- err = &(wcs->err); ++ struct wcserr **err = &(wcs->err); - /* Initialize if required. */ + // Initialize if required. ++ int status; if (wcs->flag != WCSSET) { if ((status = wcsset(wcs))) return fix_wcserr[status]; } @@ -28113,7 +32727,33 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c if (wcs->m_flag == WCSSET && wcs->pv == wcs->m_pv) { if (!(wcs->pv = calloc(wcs->npv+2, sizeof(struct pvcard)))) { wcs->pv = wcs->m_pv; -@@ -975,16 +976,16 @@ int celfix(struct wcsprm *wcs) +@@ -946,7 +944,7 @@ int celfix(struct wcsprm *wcs) + wcs->npvmax = wcs->npv + 2; + wcs->m_flag = WCSSET; + +- for (k = 0; k < wcs->npv; k++) { ++ for (int k = 0; k < wcs->npv; k++) { + wcs->pv[k] = wcs->m_pv[k]; + } + +@@ -958,6 +956,8 @@ int celfix(struct wcsprm *wcs) + } + } + ++ struct celprm *wcscel = &(wcs->cel); ++ struct prjprm *wcsprj = &(wcscel->prj); + wcs->pv[wcs->npv].i = wcs->lat + 1; + wcs->pv[wcs->npv].m = 1; + wcs->pv[wcs->npv].value = wcsprj->pv[1]; +@@ -968,23 +968,23 @@ int celfix(struct wcsprm *wcs) + wcs->pv[wcs->npv].value = wcsprj->pv[2]; + (wcs->npv)++; + +- return 0; ++ return FIXERR_SUCCESS; + + } else if (strcmp(wcs->ctype[wcs->lat]+5, "GLS") == 0) { + strcpy(wcs->ctype[wcs->lng]+5, "SFL"); strcpy(wcs->ctype[wcs->lat]+5, "SFL"); if (wcs->crval[wcs->lng] != 0.0 || wcs->crval[wcs->lat] != 0.0) { @@ -28139,7 +32779,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c if (wcs->m_flag == WCSSET && wcs->pv == wcs->m_pv) { if (!(wcs->pv = calloc(wcs->npv+3, sizeof(struct pvcard)))) { wcs->pv = wcs->m_pv; -@@ -1011,7 +1012,7 @@ int celfix(struct wcsprm *wcs) +@@ -994,7 +994,7 @@ int celfix(struct wcsprm *wcs) + wcs->npvmax = wcs->npv + 3; + wcs->m_flag = WCSSET; + +- for (k = 0; k < wcs->npv; k++) { ++ for (int k = 0; k < wcs->npv; k++) { + wcs->pv[k] = wcs->m_pv[k]; + } + +@@ -1011,7 +1011,7 @@ int celfix(struct wcsprm *wcs) wcs->pv[wcs->npv].value = 1.0; (wcs->npv)++; @@ -28148,7 +32797,15 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c wcs->pv[wcs->npv].i = wcs->lng + 1; wcs->pv[wcs->npv].m = 1; wcs->pv[wcs->npv].value = 0.0; -@@ -1030,7 +1031,7 @@ int celfix(struct wcsprm *wcs) +@@ -1023,55 +1023,54 @@ int celfix(struct wcsprm *wcs) + (wcs->npv)++; + } + +- return 0; ++ return FIXERR_SUCCESS; + } + } + return FIXERR_NO_CHANGE; } @@ -28157,12 +32814,23 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c int cylfix(const int naxis[], struct wcsprm *wcs) -@@ -1047,17 +1048,17 @@ int cylfix(const int naxis[], struct wcs + { + static const char *function = "cylfix"; + +- unsigned short icnr, indx[NMAX], ncnr; +- int j, k, stat[4], status; +- double img[4][NMAX], lat, lng, phi[4], phi0, phimax, phimin, pix[4][NMAX], +- *pixj, theta[4], theta0, world[4][NMAX], x, y; +- struct wcserr **err; +- + if (naxis == 0x0) return FIXERR_NO_CHANGE; if (wcs == 0x0) return FIXERR_NULL_POINTER; - err = &(wcs->err); +- err = &(wcs->err); ++ struct wcserr **err = &(wcs->err); - /* Initialize if required. */ + // Initialize if required. ++ int status; if (wcs->flag != WCSSET) { if ((status = wcsset(wcs))) return fix_wcserr[status]; } @@ -28174,20 +32842,47 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c - /* Compute the native longitude in each corner of the image. */ +- ncnr = 1 << wcs->naxis; + // Compute the native longitude in each corner of the image. - ncnr = 1 << wcs->naxis; ++ unsigned short ncnr = 1 << wcs->naxis; - for (k = 0; k < NMAX; k++) { -@@ -1067,7 +1068,7 @@ int cylfix(const int naxis[], struct wcs - phimin = 1.0e99; - phimax = -1.0e99; - for (icnr = 0; icnr < ncnr;) { +- for (k = 0; k < NMAX; k++) { ++ unsigned short indx[NMAX]; ++ for (int k = 0; k < NMAX; k++) { + indx[k] = 1 << k; + } + +- phimin = 1.0e99; +- phimax = -1.0e99; +- for (icnr = 0; icnr < ncnr;) { - /* Do four corners at a time. */ +- for (j = 0; j < 4; j++, icnr++) { +- pixj = pix[j]; ++ int stat[4]; ++ double img[4][NMAX], phi[4], pix[4][NMAX], theta[4], world[4][NMAX]; ++ ++ double phimin = 1.0e99; ++ double phimax = -1.0e99; ++ for (unsigned short icnr = 0; icnr < ncnr;) { + // Do four corners at a time. - for (j = 0; j < 4; j++, icnr++) { - pixj = pix[j]; ++ for (int j = 0; j < 4; j++, icnr++) { ++ double *pixj = pix[j]; -@@ -1091,11 +1092,11 @@ int cylfix(const int naxis[], struct wcs +- for (k = 0; k < wcs->naxis; k++) { ++ for (int k = 0; k < wcs->naxis; k++) { + if (icnr & indx[k]) { + *(pixj++) = naxis[k] + 0.5; + } else { +@@ -1082,7 +1081,7 @@ int cylfix(const int naxis[], struct wcs + + if (!(status = wcsp2s(wcs, 4, NMAX, pix[0], img[0], phi, theta, world[0], + stat))) { +- for (j = 0; j < 4; j++) { ++ for (int j = 0; j < 4; j++) { + if (phi[j] < phimin) phimin = phi[j]; + if (phi[j] > phimax) phimax = phi[j]; + } +@@ -1091,14 +1090,15 @@ int cylfix(const int naxis[], struct wcs if (phimin > phimax) return fix_wcserr[status]; @@ -28197,11 +32892,26 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c - /* Compute the new reference pixel coordinates. */ +- phi0 = (phimin + phimax) / 2.0; +- theta0 = 0.0; + // Compute the new reference pixel coordinates. - phi0 = (phimin + phimax) / 2.0; - theta0 = 0.0; ++ double phi0 = (phimin + phimax) / 2.0; ++ double theta0 = 0.0; -@@ -1120,13 +1121,13 @@ int cylfix(const int naxis[], struct wcs ++ double x, y; + if ((status = prjs2x(&(wcs->cel.prj), 1, 1, 1, 1, &phi0, &theta0, &x, &y, + stat))) { + if (status == PRJERR_BAD_PARAM) { +@@ -1109,7 +1109,7 @@ int cylfix(const int naxis[], struct wcs + return wcserr_set(WCSFIX_ERRMSG(status)); + } + +- for (k = 0; k < wcs->naxis; k++) { ++ for (int k = 0; k < wcs->naxis; k++) { + img[0][k] = 0.0; + } + img[0][wcs->lng] = x; +@@ -1120,15 +1120,15 @@ int cylfix(const int naxis[], struct wcs } @@ -28213,20 +32923,382 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.c } - /* Compute native coordinates of the celestial pole. */ +- lng = 0.0; +- lat = 90.0; + // Compute native coordinates of the celestial pole. - lng = 0.0; - lat = 90.0; ++ double lng = 0.0; ++ double lat = 90.0; (void)sphs2x(wcs->cel.euler, 1, 1, 1, 1, &lng, &lat, phi, theta); -Index: astropy-4.2/cextern/wcslib/C/wcsfix.h + + wcs->crpix[wcs->lng] = pix[0][wcs->lng]; +@@ -1139,3 +1139,357 @@ int cylfix(const int naxis[], struct wcs + + return wcsset(wcs); + } ++ ++//---------------------------------------------------------------------------- ++ ++// Helper function used only by wcspcx(). ++static int unscramble(int n, int mapto[], int step, int type, void *vptr); ++ ++int wcspcx( ++ struct wcsprm *wcs, ++ int dopc, ++ int permute, ++ double rotn[2]) ++ ++{ ++ static const char *function = "wcspcx"; ++ ++ // Initialize if required. ++ if (wcs == 0x0) return FIXERR_NULL_POINTER; ++ struct wcserr **err = &(wcs->err); ++ ++ int status; ++ if (wcs->flag != WCSSET) { ++ if ((status = wcsset(wcs))) return fix_wcserr[status]; ++ } ++ ++ // Check for CDi_j usage. ++ double *wcscd = wcs->cd; ++ if ((wcs->altlin & 1) || !(wcs->altlin & 2)) { ++ if ((wcs->altlin & 1) && dopc == 1) { ++ // Recompose PCi_j + CDELTi. ++ wcscd = wcs->pc; ++ } else { ++ return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM), ++ "CDi_j is not used in this coordinate representation"); ++ } ++ } ++ ++ // Check for sequent distortions. ++ if (wcs->lin.disseq) { ++ return wcserr_set(WCSERR_SET(FIXERR_BAD_COORD_TRANS), ++ "Cannot handle coordinate descriptions containing sequent distortions"); ++ } ++ ++ ++ // Allocate memory in bulk for two nxn matrices. ++ int naxis = wcs->naxis; ++ double *mem; ++ if ((mem = calloc(2*naxis*naxis, sizeof(double))) == 0x0) { ++ return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY)); ++ } ++ ++ double *mat = mem; ++ double *inv = mem + naxis*naxis; ++ ++ // Construct the transpose of CDi_j with each element squared. ++ double *matij = mat; ++ for (int i = 0; i < naxis; i++) { ++ double *cdji = wcscd + i; ++ for (int j = 0; j < naxis; j++) { ++ *(matij++) = (*cdji) * (*cdji); ++ cdji += naxis; ++ } ++ } ++ ++ // Invert the matrix. ++ if ((status = matinv(naxis, mat, inv))) { ++ return wcserr_set(WCSERR_SET(FIXERR_SINGULAR_MTX), ++ "No solution for CDi_j matrix decomposition"); ++ } ++ ++ // Apply scaling. ++ double *invij = inv; ++ double *pcij = wcs->pc; ++ double *cdij = wcscd; ++ for (int i = 0; i < naxis; i++) { ++ double scl = 0.0; ++ for (int j = 0; j < naxis; j++) { ++ scl += *(invij++); ++ } ++ ++ scl = sqrt(scl); ++ wcs->cdelt[i] /= scl; ++ ++ for (int j = 0; j < naxis; j++) { ++ *(pcij++) = *(cdij++) * scl; ++ } ++ } ++ ++ // mapto[i] records where row i of PCi_j should move to. ++ int *mapto; ++ if ((mapto = (int*)malloc(naxis * sizeof(int))) == 0x0) { ++ free(mem); ++ return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY)); ++ } ++ for (int i = 0; i < naxis; i++) { ++ mapto[i] = -1; ++ } ++ ++ // Ensure that latitude always follows longitude. ++ if (wcs->lng >= 0 && wcs->lat >= 0) { ++ double *pci = wcs->pc + naxis*wcs->lng; ++ ++ // Take the first non-zero element in the row. ++ for (int j = 0; j < naxis; j++) { ++ if (fabs(pci[j]) != 0.0) { ++ mapto[wcs->lng] = j; ++ break; ++ } ++ } ++ ++ if (mapto[wcs->lng] == naxis-1) { ++ mapto[wcs->lng]--; ++ } ++ ++ mapto[wcs->lat] = mapto[wcs->lng] + 1; ++ } ++ ++ // Fill in the rest of the row permutation map. ++ for (int j = 0; j < naxis; j++) { ++ // Column j. ++ double *pcij = wcs->pc + j; ++ double colmax = 0.0; ++ ++ // Look down the column to find the absolute maximum element. ++ for (int i = 0; i < naxis; i++, pcij += naxis) { ++ if (!(mapto[i] < 0)) { ++ // This row is already mapped. ++ continue; ++ } ++ ++ if (fabs(*pcij) > colmax) { ++ mapto[i] = j; ++ colmax = fabs(*pcij); ++ } ++ } ++ } ++ ++ // Fix the sign of CDELTi. Celestial axes are special, otherwise diagonal ++ // elements of the correctly permuted matrix should be positive. ++ for (int i = 0; i < naxis; i++) { ++ int chsgn; ++ double *pci = wcs->pc + naxis*i; ++ ++ // Celestial axes are special. ++ if (i == wcs->lng) { ++ // Longitude axis - force CDELTi < 0.0. ++ chsgn = (wcs->cdelt[i] > 0.0); ++ } else if (i == wcs->lat) { ++ // Latitude axis - force CDELTi > 0.0. ++ chsgn = (wcs->cdelt[i] < 0.0); ++ } else { ++ chsgn = (pci[mapto[i]] < 0.0); ++ } ++ ++ if (chsgn) { ++ wcs->cdelt[i] = -wcs->cdelt[i]; ++ ++ for (int j = 0; j < naxis; j++) { ++ // Test needed to prevent negative zeros. ++ if (pci[j] != 0.0) { ++ pci[j] = -pci[j]; ++ } ++ } ++ } ++ } ++ ++ free(mem); ++ ++ // Setting bit 3 in wcsprm::altlin stops wcsset() from reconstructing ++ // PCi_j and CDELTi from CDi_j. ++ wcs->altlin |= 8; ++ ++ ++ // Compute rotation angle of each basis vector of the celestial axes. ++ if (rotn) { ++ if (wcs->lng < 0 || wcs->lat < 0) { ++ // No celestial axes. ++ rotn[0] = 0.0; ++ rotn[1] = 0.0; ++ ++ } else { ++ double x, y; ++ x = wcs->pc[naxis*wcs->lng + mapto[wcs->lng]]; ++ y = wcs->pc[naxis*wcs->lat + mapto[wcs->lng]]; ++ rotn[0] = atan2d(y, x); ++ ++ y = -wcs->pc[naxis*wcs->lng + mapto[wcs->lat]]; ++ x = wcs->pc[naxis*wcs->lat + mapto[wcs->lat]]; ++ rotn[1] = atan2d(y, x); ++ } ++ } ++ ++ ++ // Permute rows? ++ if (permute) { ++ // Check whether there's anything to unscramble. ++ int scrambled = 0; ++ for (int i = 0; i < naxis; i++) { ++ if (mapto[i] != i) { ++ scrambled = 1; ++ break; ++ } ++ } ++ ++ if (scrambled) { ++ for (int i = 0; i < naxis; i++) { ++ // Do columns of the PCi_ja matrix. ++ if (unscramble(naxis, mapto, naxis, 1, wcs->pc + i)) { ++ free(mapto); ++ return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY)); ++ } ++ } ++ ++ if (unscramble(naxis, mapto, 1, 1, wcs->cdelt) || ++ unscramble(naxis, mapto, 1, 1, wcs->crval) || ++ unscramble(naxis, mapto, 1, 2, wcs->cunit) || ++ unscramble(naxis, mapto, 1, 2, wcs->ctype)) { ++ free(mapto); ++ return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY)); ++ } ++ ++ for (int ipv = 0; ipv < wcs->npv; ipv++) { ++ // Noting that PVi_ma axis numbers are 1-relative. ++ int i = wcs->pv[ipv].i - 1; ++ wcs->pv[ipv].i = mapto[i] + 1; ++ } ++ ++ for (int ips = 0; ips < wcs->nps; ips++) { ++ // Noting that PSi_ma axis numbers are 1-relative. ++ int i = wcs->ps[ips].i - 1; ++ wcs->ps[ips].i = mapto[i] + 1; ++ } ++ ++ if (wcs->altlin & 2) { ++ for (int i = 0; i < naxis; i++) { ++ // Do columns of the CDi_ja matrix. ++ if (unscramble(naxis, mapto, naxis, 1, wcs->cd + i)) { ++ free(mapto); ++ return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY)); ++ } ++ } ++ } ++ ++ if (wcs->altlin & 4) { ++ if (unscramble(naxis, mapto, 1, 1, wcs->crota)) { ++ free(mapto); ++ return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY)); ++ } ++ } ++ ++ if (unscramble(naxis, mapto, 1, 3, wcs->colax) || ++ unscramble(naxis, mapto, 1, 2, wcs->cname) || ++ unscramble(naxis, mapto, 1, 1, wcs->crder) || ++ unscramble(naxis, mapto, 1, 1, wcs->csyer) || ++ unscramble(naxis, mapto, 1, 1, wcs->czphs) || ++ unscramble(naxis, mapto, 1, 1, wcs->cperi)) { ++ free(mapto); ++ return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY)); ++ } ++ ++ // Coordinate lookup tables. ++ for (int itab = 0; itab < wcs->ntab; itab++) { ++ for (int m = 0; m < wcs->tab[itab].M; m++) { ++ int i = wcs->tab[itab].map[m]; ++ wcs->tab[itab].map[m] = mapto[i]; ++ } ++ } ++ ++ for (int iwtb = 0; iwtb < wcs->nwtb; iwtb++) { ++ int i = wcs->wtb[iwtb].i; ++ wcs->wtb[iwtb].i = mapto[i]; ++ } ++ ++ // Distortions? No. Prior distortions operate on pixel coordinates and ++ // therefore are not permuted, and sequent distortions are not handled. ++ } ++ } ++ ++ free(mapto); ++ ++ // Reset the struct. ++ if ((status = wcsset(wcs))) return fix_wcserr[status]; ++ ++ return FIXERR_SUCCESS; ++} ++ ++ ++int unscramble( ++ int n, ++ int mapto[], ++ int step, ++ int type, ++ void *vptr) ++ ++{ ++ if (step == 0) step = 1; ++ ++ if (type == 1) { ++ double *dval = (double *)vptr; ++ ++ double *dtmp; ++ if ((dtmp = (double *)malloc(n * sizeof(double))) == 0x0) { ++ return 1; ++ } ++ ++ for (int i = 0; i < n; i++) { ++ dtmp[mapto[i]] = dval[i*step]; ++ } ++ ++ for (int i = 0; i < n; i++) { ++ dval[i*step] = dtmp[i]; ++ } ++ ++ free(dtmp); ++ ++ } else if (type == 2) { ++ char (*cval)[72] = (char (*)[72])vptr; ++ ++ int row_size = 72 * sizeof(char); ++ char *ctmp; ++ if ((ctmp = (char *)malloc(n * row_size)) == 0x0) { ++ return 1; ++ } ++ ++ for (int i = 0; i < n; i++) { ++ memcpy(ctmp + row_size * mapto[i], cval[i], 72); ++ } ++ ++ for (int i = 0; i < n; i++) { ++ memcpy(cval[i], ctmp + row_size * i, 72); ++ } ++ ++ free(ctmp); ++ ++ } else if (type == 3) { ++ int *ival = (int *)vptr; ++ ++ int *itmp; ++ if ((itmp = (int *)malloc(n * sizeof(int))) == 0x0) { ++ return 1; ++ } ++ ++ for (int i = 0; i < n; i++) { ++ itmp[mapto[i]] = ival[i]; ++ } ++ ++ for (int i = 0; i < n; i++) { ++ ival[i] = itmp[i]; ++ } ++ ++ free(itmp); ++ } ++ ++ return 0; ++} +Index: astropy-4.2.1/cextern/wcslib/C/wcsfix.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcsfix.h -+++ astropy-4.2/cextern/wcslib/C/wcsfix.h +--- astropy-4.2.1.orig/cextern/wcslib/C/wcsfix.h ++++ astropy-4.2.1/cextern/wcslib/C/wcsfix.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -28240,15 +33312,29 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsfix.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcsfix.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcsfix.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * -@@ -92,18 +89,17 @@ +@@ -57,6 +54,13 @@ + * consistency of pairs of keyvalues that define the same measure in two + * different ways, for example, as a date and an MJD. + * ++* A separate routine, wcspcx(), "regularizes" the linear transformation matrix ++* component (PCi_j) of the coordinate transformation to make it more human- ++* readable. Where a coordinate description was constructed from CDi_j, it ++* decomposes it into PCi_j + CDELTi in a meaningful way. Optionally, it can ++* also diagonalize the PCi_j matrix (as far as possible), i.e. undo the ++* transposition of axes in the intermediate pixel coordinate system. ++* + * Non-standard keyvalues: + * ----------------------- + * AIPS-convention celestial projection types, NCP and GLS, and spectral +@@ -92,18 +96,17 @@ * header parser supplied with WCSLIB, refer to wcshdr.h. * * wcsfix() and wcsfixi() apply all of the corrections handled by the following @@ -28273,7 +33359,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.h * * - obsfix(): if only one half of obsgeo[] is set, then derive the other * half from it. If both halves are set, then check consistency. -@@ -173,7 +169,7 @@ +@@ -173,11 +176,14 @@ * cdfix() - Fix erroneously omitted CDi_ja keywords * ------------------------------------------------- * cdfix() sets the diagonal element of the CDi_ja matrix to unity if all @@ -28282,7 +33368,14 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.h * Paper I, if any CDi_ja keywords at all are given in a FITS header then those * not given default to zero. This results in a singular matrix with an * intersecting row and column of zeros. -@@ -192,14 +188,13 @@ + * ++* cdfix() is expected to be invoked before wcsset(), which will fail if these ++* errors have not been corrected. ++* + * Given and returned: + * wcs struct wcsprm* + * Coordinate transformation parameters. +@@ -192,20 +198,22 @@ * datfix() - Translate DATE-OBS and derive MJD-OBS or vice versa * -------------------------------------------------------------- * datfix() translates the old DATE-OBS date format set in wcsprm::dateobs to @@ -28304,7 +33397,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.h * * If neither dateobs nor mjdobs are set, but wcsprm::jepoch (primarily) or * wcsprm::bepoch is, then both are derived from it. If jepoch and/or bepoch -@@ -222,13 +217,15 @@ + * are set but disagree with dateobs or mjdobs by more than 0.000002 year + * (63.2 seconds), an informative message is produced. + * ++* The translations done by datfix() do not affect and are not affected by ++* wcsset(). ++* + * Given and returned: + * wcs struct wcsprm* + * Coordinate transformation parameters. +@@ -222,13 +230,15 @@ * 1: Null wcsprm pointer passed. * 5: Invalid parameter value. * @@ -28325,7 +33427,17 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.h * * * obsfix() - complete the OBSGEO-[XYZLBH] vector of observatory coordinates -@@ -261,8 +258,10 @@ +@@ -239,6 +249,9 @@ + * it. If both triplets are set, then it checks for consistency at the level + * of 1 metre. + * ++* The operations done by obsfix() do not affect and are not affected by ++* wcsset(). ++* + * Given: + * ctrl int Flag that controls behaviour if one triplet is + * defined and the other is only partially defined: +@@ -261,8 +274,10 @@ * 1: Null wcsprm pointer passed. * 5: Invalid parameter value. * @@ -28338,7 +33450,17 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.h * * Notes: * 1: While the International Terrestrial Reference System (ITRS) is based -@@ -332,9 +331,10 @@ +@@ -318,6 +333,9 @@ + * unitfix() applies wcsutrn() to translate non-standard CUNITia keyvalues, + * e.g. 'DEG' -> 'deg', also stripping off unnecessary whitespace. + * ++* unitfix() is expected to be invoked before wcsset(), which will fail if ++* non-standard CUNITia keyvalues have not been translated. ++* + * Given: + * ctrl int Do potentially unsafe translations described in the + * usage notes to wcsutrn(). +@@ -332,9 +350,10 @@ * 0: Success (an alias was applied). * 1: Null wcsprm pointer passed. * @@ -28352,7 +33474,24 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.h * * * spcfix() - Translate AIPS-convention spectral types -@@ -364,8 +364,10 @@ +@@ -345,6 +364,16 @@ + * + * Note that if wcs::specsys is already set then it will not be overridden. + * ++* AIPS-convention spectral types set in CTYPEia are translated on-the-fly by ++* wcsset() but without modifying wcsprm::ctype[] or wcsprm::specsys. That is, ++* only the information extracted from wcsprm::ctype[] is translated when ++* wcsset() fills in wcsprm::spc (spcprm struct). spcfix() modifies ++* wcsprm::ctype[] so that if the header is subsequently written out, e.g. by ++* wcshdo(), then it will contain translated CTYPEia keyvalues. ++* ++* The operations done by spcfix() do not affect and are not affected by ++* wcsset(). ++* + * Given and returned: + * wcs struct wcsprm* + * Coordinate transformation parameters. wcsprm::ctype[] +@@ -364,8 +393,10 @@ * 7: Ill-conditioned coordinate transformation * parameters. * @@ -28365,7 +33504,136 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.h * * * celfix() - Translate AIPS-convention celestial projection types -@@ -465,29 +467,27 @@ extern const char *wcsfix_errmsg[]; +@@ -379,6 +410,18 @@ + * necessary. Otherwise, error 2 will be returned if sufficient empty slots + * are not already available for use. + * ++* AIPS-convention celestial projection types set in CTYPEia are translated ++* on-the-fly by wcsset() but without modifying wcsprm::ctype[], wcsprm::pv[], ++* or wcsprm::npv. That is, only the information extracted from ++* wcsprm::ctype[] is translated when wcsset() fills in wcsprm::cel (celprm ++* struct). celfix() modifies wcsprm::ctype[], wcsprm::pv[], and wcsprm::npv ++* so that if the header is subsequently written out, e.g. by wcshdo(), then it ++* will contain translated CTYPEia keyvalues and the relevant PVi_ma. ++* ++* The operations done by celfix() do not affect and are not affected by ++* wcsset(). However, it uses information in the wcsprm struct provided by ++* wcsset(), and will invoke it if necessary. ++* + * Given and returned: + * wcs struct wcsprm* + * Coordinate transformation parameters. wcsprm::ctype[] +@@ -407,6 +450,10 @@ + * cylfix() fixes WCS keyvalues for malformed cylindrical projections that + * suffer from the problem described in Sect. 7.3.4 of Paper I. + * ++* cylfix() requires the wcsprm struct to have been set up by wcsset(), and ++* will invoke it if necessary. After modification, the struct is reset on ++* return with an explicit call to wcsset(). ++* + * Given: + * naxis const int [] + * Image axis lengths. +@@ -436,6 +483,98 @@ + * wcsprm::err if enabled, see wcserr_enable(). + * + * ++* wcspcx() - regularize PCi_j ++* --------------------------- ++* wcspcx() "regularizes" the linear transformation matrix component of the ++* coordinate transformation (PCi_ja) to make it more human-readable. ++* ++* Normally, upon encountering a FITS header containing a CDi_ja matrix, ++* wcsset() simply treats it as PCi_ja and sets CDELTia to unity. However, ++* wcspcx() decomposes CDi_ja into PCi_ja and CDELTia in such a way that ++* CDELTia form meaningful scaling parameters. In practice, the residual ++* PCi_ja matrix will often then be orthogonal, i.e. unity, or describing a ++* pure rotation, axis permutation, or reflection, or a combination thereof. ++* ++* The decomposition is based on normalizing the length in the transformed ++* system (i.e. intermediate pixel coordinates) of the orthonormal basis ++* vectors of the pixel coordinate system. This deviates slightly from the ++* prescription given by Eq. (4) of WCS Paper I, namely Sum(j=1,N)(PCi_ja)² = 1, ++* in replacing the sum over j with the sum over i. Consequently, the columns ++* of PCi_ja will consist of unit vectors. In practice, especially in cubes ++* and higher dimensional images, at least some pairs of these unit vectors, if ++* not all, will often be orthogonal or close to orthogonal. ++* ++* The sign of CDELTia is chosen to make the PCi_ja matrix as close to the, ++* possibly permuted, unit matrix as possible, except that where the coordinate ++* description contains a pair of celestial axes, the sign of CDELTia is set ++* negative for the longitude axis and positive for the latitude axis. ++* ++* Optionally, rows of the PCi_ja matrix may also be permuted to diagonalize ++* it as far as possible, thus undoing any transposition of axes in the ++* intermdiate pixel coordinate system. ++* ++* If the coordinate description contains a celestial plane, then the angle of ++* rotation of each of the basis vectors associated with the celestial axes is ++* returned. For a pure rotation the two angles should be identical. Any ++* difference between them is a measure of axis skewness. ++* ++* The decomposition is not performed for axes involving a sequent distortion ++* function that is defined in terms of CDi_ja, such as TPV, TNX, or ZPX, which ++* always are. The independent variables of the polynomial are therefore ++* intermediate world coordinates rather than intermediate pixel coordinates. ++* Because sequent distortions are always applied before CDELTia, if CDi_ja was ++* translated to PCi_ja plus CDELTia, then the distortion would be altered ++* unless the polynomial coefficients were also adjusted to account for the ++* change of scale. ++* ++* wcspcx() requires the wcsprm struct to have been set up by wcsset(), and ++* will invoke it if necessary. The wcsprm struct is reset on return with an ++* explicit call to wcsset(). ++* ++* Given and returned: ++* wcs struct wcsprm* ++* Coordinate transformation parameters. ++* ++* Given: ++* dopc int If 1, then PCi_ja and CDELTia, as given, will be ++* recomposed according to the above prescription. If 0, ++* the operation is restricted to decomposing CDi_ja. ++* ++* permute int If 1, then after decomposition (or recomposition), ++* permute rows of PCi_ja to make the axes of the ++* intermediate pixel coordinate system match as closely ++* as possible those of the pixel coordinates. That is, ++* make it as close to a diagonal matrix as possible. ++* However, celestial axes are special in always being ++* paired, with the longitude axis preceding the latitude ++* axis. ++* ++* All WCS entities indexed by i, such as CTYPEia, ++* CRVALia, CDELTia, etc., including coordinate lookup ++* tables, will also be permuted as necessary to account ++* for the change to PCi_ja. This does not apply to ++* CRPIXja, nor prior distortion functions. These ++* operate on pixel coordinates, which are not affected ++* by the permutation. ++* ++* Returned: ++* rotn double[2] Rotation angle [deg] of each basis vector associated ++* with the celestial axes. For a pure rotation the two ++* angles should be identical. Any difference between ++* them is a measure of axis skewness. ++* ++* May be set to the NULL pointer if this information is ++* not required. ++* ++* Function return value: ++* int Status return value: ++* 0: Success. ++* 1: Null wcsprm pointer passed. ++* 2: Memory allocation failed. ++* 5: CDi_j matrix not used. ++* 6: Sequent distortion function present. ++* ++* + * Global variable: const char *wcsfix_errmsg[] - Status return messages + * --------------------------------------------------------------------- + * Error messages to match the status value returned from each function. +@@ -465,29 +604,27 @@ extern const char *wcsfix_errmsg[]; #define cylfix_errmsg wcsfix_errmsg enum wcsfix_errmsg_enum { @@ -28416,22 +33684,29 @@ Index: astropy-4.2/cextern/wcslib/C/wcsfix.h }; int wcsfix(int ctrl, const int naxis[], struct wcsprm *wcs, int stat[]); -@@ -514,4 +514,4 @@ int cylfix(const int naxis[], struct wcs +@@ -509,9 +646,11 @@ int celfix(struct wcsprm *wcs); + + int cylfix(const int naxis[], struct wcsprm *wcs); + ++int wcspcx(struct wcsprm *wcs, int dopc, int permute, double rotn[2]); ++ + + #ifdef __cplusplus } #endif -#endif /* WCSLIB_WCSFIX */ +#endif // WCSLIB_WCSFIX -Index: astropy-4.2/cextern/wcslib/C/wcshdr.c +Index: astropy-4.2.1/cextern/wcslib/C/wcshdr.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcshdr.c -+++ astropy-4.2/cextern/wcslib/C/wcshdr.c +--- astropy-4.2.1.orig/cextern/wcslib/C/wcshdr.c ++++ astropy-4.2.1/cextern/wcslib/C/wcshdr.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -28445,7 +33720,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcshdr.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcshdr.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcshdr.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcshdr.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -29916,16 +35191,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcshdr.c nc -= (nv - 20); } -Index: astropy-4.2/cextern/wcslib/C/wcshdr.h +Index: astropy-4.2.1/cextern/wcslib/C/wcshdr.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcshdr.h -+++ astropy-4.2/cextern/wcslib/C/wcshdr.h +--- astropy-4.2.1.orig/cextern/wcslib/C/wcshdr.h ++++ astropy-4.2.1/cextern/wcslib/C/wcshdr.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -29939,11 +35214,11 @@ Index: astropy-4.2/cextern/wcslib/C/wcshdr.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcshdr.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcshdr.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcshdr.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * @@ -30140,16 +35415,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcshdr.h -#endif /* WCSLIB_WCSHDR */ +#endif // WCSLIB_WCSHDR -Index: astropy-4.2/cextern/wcslib/C/wcslib.h +Index: astropy-4.2.1/cextern/wcslib/C/wcslib.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcslib.h -+++ astropy-4.2/cextern/wcslib/C/wcslib.h +--- astropy-4.2.1.orig/cextern/wcslib/C/wcslib.h ++++ astropy-4.2.1/cextern/wcslib/C/wcslib.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -30163,11 +35438,11 @@ Index: astropy-4.2/cextern/wcslib/C/wcslib.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcslib.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcslib.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcslib.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * @@ -30177,16 +35452,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcslib.h -#endif /* WCSLIB_WCSLIB */ +#endif // WCSLIB_WCSLIB -Index: astropy-4.2/cextern/wcslib/C/wcsmath.h +Index: astropy-4.2.1/cextern/wcslib/C/wcsmath.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcsmath.h -+++ astropy-4.2/cextern/wcslib/C/wcsmath.h +--- astropy-4.2.1.orig/cextern/wcslib/C/wcsmath.h ++++ astropy-4.2.1/cextern/wcslib/C/wcsmath.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -30200,11 +35475,11 @@ Index: astropy-4.2/cextern/wcslib/C/wcsmath.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsmath.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcsmath.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcsmath.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * @@ -30214,16 +35489,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcsmath.h -#endif /* WCSLIB_WCSMATH */ +#endif // WCSLIB_WCSMATH -Index: astropy-4.2/cextern/wcslib/C/wcspih.l +Index: astropy-4.2.1/cextern/wcslib/C/wcspih.l =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcspih.l -+++ astropy-4.2/cextern/wcslib/C/wcspih.l +--- astropy-4.2.1.orig/cextern/wcslib/C/wcspih.l ++++ astropy-4.2.1/cextern/wcslib/C/wcspih.l @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -30237,104 +35512,212 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcspih.l,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcspih.l,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcspih.l,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * * wcspih.l is a Flex description file containing the definition of a lexical -@@ -141,7 +138,7 @@ static int wcspih_scanner(char *header, - int *nreject, int *nwcs, struct wcsprm **wcs, - yyscan_t yyscanner); +@@ -73,6 +70,7 @@ + %option outfile="wcspih.c" + %option prefix="wcspih" + %option reentrant ++%option extra-type="struct wcspih_extra *" + /* Indices for parameterized keywords. */ + Z1 [0-9] +@@ -137,58 +135,37 @@ INLINE " "*(\/.*)? + #define DSS 2 + #define WAT 3 + +-static int wcspih_scanner(char *header, int nkeyrec, int relax, int ctrl, +- int *nreject, int *nwcs, struct wcsprm **wcs, +- yyscan_t yyscanner); +- -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- - - int wcspih( - char *header, -@@ -166,7 +163,7 @@ int wcspih( - return status; - } - +- +-int wcspih( +- char *header, +- int nkeyrec, +- int relax, +- int ctrl, +- int *nreject, +- int *nwcs, +- struct wcsprm **wcs) +- +-{ +- int status; +- yyscan_t yyscanner; +- int yylex_init(yyscan_t *yyscanner); +- int yylex_destroy(yyscan_t yyscanner); +- +- yylex_init(&yyscanner); +- status = wcspih_scanner(header, nkeyrec, relax, ctrl, nreject, nwcs, wcs, +- yyscanner); +- yylex_destroy(yyscanner); +- +- return status; +-} +- -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- ++// User data associated with yyscanner. ++struct wcspih_extra { ++ // Values passed to YY_INPUT. ++ char *hdr; ++ int nkeyrec; ++ ++ // Used in preempting the call to exit() by yy_fatal_error(). ++ jmp_buf abort_jmp_env; ++}; #define YY_DECL int wcspih_scanner(char *header, int nkeyrec, int relax, \ int ctrl, int *nreject, int *nwcs, struct wcsprm **wcs, yyscan_t yyscanner) -@@ -184,11 +181,11 @@ int wcspih( + + #define YY_INPUT(inbuff, count, bufsize) \ + { \ +- if (wcspih_nkeyrec) { \ +- strncpy(inbuff, wcspih_hdr, 80); \ ++ if (yyextra->nkeyrec) { \ ++ strncpy(inbuff, yyextra->hdr, 80); \ + inbuff[80] = '\n'; \ +- wcspih_hdr += 80; \ +- wcspih_nkeyrec--; \ ++ yyextra->hdr += 80; \ ++ yyextra->nkeyrec--; \ + count = 81; \ + } else { \ + count = YY_NULL; \ } \ } -/* These global variables are required by YY_INPUT. */ -+// These global variables are required by YY_INPUT. - static char *wcspih_hdr; - static int wcspih_nkeyrec; +-static char *wcspih_hdr; +-static int wcspih_nkeyrec; ++// Preempt the call to exit() by yy_fatal_error(). ++#define exit(status) longjmp(yyextra->abort_jmp_env, status); -/* Internal helper functions. */ +// Internal helper functions. ++static YY_DECL; static int wcspih_final(int ndp[], int ndq[], int distran, double dsstmp[], char *wat[], int *nwcs, struct wcsprm **wcs); static int wcspih_init1(int naxis, int alts[], int dpq[], int npv[], -@@ -205,14 +202,14 @@ static int wcspih_vsource(double *wptr, +@@ -205,34 +182,20 @@ static int wcspih_vsource(double *wptr, static int wcspih_timepixr(double timepixr); -/* Used in preempting the call to exit() by yy_fatal_error(). */ -+// Used in preempting the call to exit() by yy_fatal_error(). - jmp_buf wcspih_abort_jmp_env; - #define exit(status) longjmp(wcspih_abort_jmp_env, status) - +-jmp_buf wcspih_abort_jmp_env; +-#define exit(status) longjmp(wcspih_abort_jmp_env, status) +- %} %% - /* Keyword indices, as used in the WCS papers, e.g. PCi_ja, PVi_ma. */ -+ // Keyword indices, as used in the WCS papers, e.g. PCi_ja, PVi_ma. - char a; - int i, j, m, p, q; +- char a; +- int i, j, m, p, q; +- +- char *cptr, *errmsg, errtxt[80], *hptr, *keep, *keyname, *keyrec, +- keyword[16], strtmp[80], *wat[2], *watstr; +- int altlin, alts[27], auxprm, distran, distype, dpq[27], dssflag, +- gotone, ialt, inttmp, ipass, ipx, ix, jx, naux, naxis, +- ndp[27], ndq[27], nother, *npptr, nps[27], npass, npv[27], +- nvalid, rectype, sipflag, status, valtype, watflag, watn; +- ptrdiff_t voff; ++ int p, q; ++ char *errmsg, errtxt[80], *keyname, strtmp[80], *wat[2], *watstr; ++ int alts[27], dpq[27], inttmp, ndp[27], ndq[27], nps[27], npv[27], ++ rectype; + double dbltmp, dbl2tmp[2], dsstmp[20]; +- void *vptr, *wptr; +- struct auxprm *auxp, auxtem; +- struct disprm *disp, distem; +- struct wcsprm *wcsp, wcstem; +- int (*chekval)(double); +- int (*special)(double *, const double *); ++ struct auxprm auxtem; ++ struct disprm distem; ++ struct wcsprm wcstem; -@@ -241,34 +238,34 @@ jmp_buf wcspih_abort_jmp_env; +- naxis = 0; +- for (ialt = 0; ialt < 27; ialt++) { ++ int naxis = 0; ++ for (int ialt = 0; ialt < 27; ialt++) { + alts[ialt] = 0; + dpq[ialt] = 0; + npv[ialt] = 0; +@@ -241,57 +204,58 @@ jmp_buf wcspih_abort_jmp_env; ndq[ialt] = 0; } - /* Parameters used to implement YY_INPUT. */ -+ // Parameters used to implement YY_INPUT. - wcspih_hdr = header; - wcspih_nkeyrec = nkeyrec; - +- wcspih_hdr = header; +- wcspih_nkeyrec = nkeyrec; +- - /* Our handle on the input stream. */ +- keyrec = header; +- hptr = header; +- keep = 0x0; + // Our handle on the input stream. - keyrec = header; - hptr = header; - keep = 0x0; ++ char *keyrec = header; ++ char *hptr = header; ++ char *keep = 0x0; - /* For keeping tallies of keywords found. */ + // For keeping tallies of keywords found. *nreject = 0; - nvalid = 0; - nother = 0; +- nvalid = 0; +- nother = 0; ++ int nvalid = 0; ++ int nother = 0; - /* If strict, then also reject. */ + // If strict, then also reject. if (relax & WCSHDR_strict) relax |= WCSHDR_reject; - /* Keyword parameters. */ -+ // Keyword parameters. - i = j = 0; - m = 0; - a = ' '; - +- i = j = 0; +- m = 0; +- a = ' '; +- - /* For decoding the keyvalue. */ -+ // For decoding the keyvalue. - valtype = -1; - distype = 0; - vptr = 0x0; - +- valtype = -1; +- distype = 0; +- vptr = 0x0; +- - /* For keywords that require special handling. */ +- altlin = 0; +- npptr = 0x0; +- chekval = 0x0; +- special = 0x0; +- auxprm = 0; +- naux = 0; +- distran = 0; +- sipflag = 0; +- dssflag = 0; +- watflag = 0; +- watn = 0; ++ // Keyword indices, as used in the WCS papers, e.g. PCi_ja, PVi_ma. ++ int i = 0; ++ int j = 0; ++ int m = 0; ++ char a = ' '; ++ ++ // For decoding the keyvalue. ++ int valtype = -1; ++ int distype = 0; ++ void *vptr = 0x0; ++ + // For keywords that require special handling. - altlin = 0; - npptr = 0x0; - chekval = 0x0; -@@ -281,15 +278,15 @@ jmp_buf wcspih_abort_jmp_env; - watflag = 0; - watn = 0; ++ int altlin = 0; ++ int *npptr = 0x0; ++ int (*chekval)(double) = 0x0; ++ int (*special)(double *, const double *) = 0x0; ++ int auxprm = 0; ++ int naux = 0; ++ int distran = 0; ++ int sipflag = 0; ++ int dssflag = 0; ++ int watflag = 0; ++ int watn = 0; - /* The data structures produced. */ + // The data structures produced. @@ -30342,16 +35725,27 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l *wcs = 0x0; - /* Control variables. */ -+ // Control variables. - ipass = 1; - npass = 2; - +- ipass = 1; +- npass = 2; +- - /* Return here via longjmp() invoked by yy_fatal_error(). */ +- if (setjmp(wcspih_abort_jmp_env)) { +- return 3; ++ // Control variables. ++ int ipass = 1; ++ int npass = 2; ++ ++ // User data associated with yyscanner. ++ yyextra->hdr = header; ++ yyextra->nkeyrec = nkeyrec; ++ + // Return here via longjmp() invoked by yy_fatal_error(). - if (setjmp(wcspih_abort_jmp_env)) { - return 3; ++ if (setjmp(yyextra->abort_jmp_env)) { ++ return WCSHDRERR_PARSER; } -@@ -627,7 +624,7 @@ jmp_buf wcspih_abort_jmp_env; + + BEGIN(INITIAL); +@@ -627,7 +591,7 @@ jmp_buf wcspih_abort_jmp_env; ^MJDREFI" " | ^MJD-REFI { if ((yytext[3] == 'R') || (relax & WCSHDR_DATEREF)) { @@ -30360,7 +35754,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; vptr = wcstem.mjdref; -@@ -683,7 +680,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -683,7 +647,7 @@ jmp_buf wcspih_abort_jmp_env; ^JDREFI" " | ^JD-REFI { if ((yytext[2] == 'R') || (relax & WCSHDR_DATEREF)) { @@ -30369,7 +35763,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; vptr = wcstem.mjdref; special = wcspih_jdrefi; -@@ -1193,7 +1190,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1193,7 +1157,7 @@ jmp_buf wcspih_abort_jmp_env; } ^A_ORDER" " { @@ -30378,7 +35772,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = INTEGER; distype = PRIOR; vptr = 0x0; -@@ -1206,7 +1203,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1206,7 +1170,7 @@ jmp_buf wcspih_abort_jmp_env; } ^B_ORDER" " { @@ -30387,7 +35781,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = INTEGER; distype = PRIOR; vptr = 0x0; -@@ -1219,7 +1216,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1219,7 +1183,7 @@ jmp_buf wcspih_abort_jmp_env; } ^AP_ORDER { @@ -30396,7 +35790,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = INTEGER; distype = PRIOR; vptr = 0x0; -@@ -1232,7 +1229,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1232,7 +1196,7 @@ jmp_buf wcspih_abort_jmp_env; } ^BP_ORDER { @@ -30405,7 +35799,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = INTEGER; distype = PRIOR; vptr = 0x0; -@@ -1245,7 +1242,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1245,7 +1209,7 @@ jmp_buf wcspih_abort_jmp_env; } ^A_DMAX" " { @@ -30414,7 +35808,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = PRIOR; vptr = &(distem.maxdis); -@@ -1258,7 +1255,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1258,7 +1222,7 @@ jmp_buf wcspih_abort_jmp_env; } ^B_DMAX" " { @@ -30423,7 +35817,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = PRIOR; vptr = &(distem.maxdis); -@@ -1271,7 +1268,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1271,7 +1235,7 @@ jmp_buf wcspih_abort_jmp_env; } ^A_ { @@ -30432,7 +35826,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l i = 1; sipflag = 2; -@@ -1280,7 +1277,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1280,7 +1244,7 @@ jmp_buf wcspih_abort_jmp_env; } ^B_ { @@ -30441,7 +35835,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l i = 2; sipflag = 2; -@@ -1289,7 +1286,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1289,7 +1253,7 @@ jmp_buf wcspih_abort_jmp_env; } ^AP_ { @@ -30450,7 +35844,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l i = 1; sipflag = 3; -@@ -1298,7 +1295,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1298,7 +1262,7 @@ jmp_buf wcspih_abort_jmp_env; } ^BP_ { @@ -30459,7 +35853,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l i = 2; sipflag = 3; -@@ -1307,7 +1304,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1307,7 +1271,7 @@ jmp_buf wcspih_abort_jmp_env; } ^CNPIX1" " { @@ -30468,7 +35862,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = SEQUENT; vptr = dsstmp; -@@ -1319,7 +1316,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1319,7 +1283,7 @@ jmp_buf wcspih_abort_jmp_env; } ^CNPIX2" " { @@ -30477,7 +35871,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+1; -@@ -1331,7 +1328,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1331,7 +1295,7 @@ jmp_buf wcspih_abort_jmp_env; } ^PPO3" " { @@ -30486,7 +35880,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+2; -@@ -1343,7 +1340,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1343,7 +1307,7 @@ jmp_buf wcspih_abort_jmp_env; } ^PPO6" " { @@ -30495,7 +35889,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+3; -@@ -1355,7 +1352,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1355,7 +1319,7 @@ jmp_buf wcspih_abort_jmp_env; } ^XPIXELSZ { @@ -30504,7 +35898,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+4; -@@ -1367,7 +1364,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1367,7 +1331,7 @@ jmp_buf wcspih_abort_jmp_env; } ^YPIXELSZ { @@ -30513,7 +35907,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+5; -@@ -1379,7 +1376,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1379,7 +1343,7 @@ jmp_buf wcspih_abort_jmp_env; } ^PLTRAH" " { @@ -30522,7 +35916,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+6; -@@ -1391,7 +1388,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1391,7 +1355,7 @@ jmp_buf wcspih_abort_jmp_env; } ^PLTRAM" " { @@ -30531,7 +35925,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+7; -@@ -1403,7 +1400,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1403,7 +1367,7 @@ jmp_buf wcspih_abort_jmp_env; } ^PLTRAS" " { @@ -30540,7 +35934,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+8; -@@ -1415,7 +1412,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1415,7 +1379,7 @@ jmp_buf wcspih_abort_jmp_env; } ^PLTDECSN { @@ -30549,7 +35943,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = STRING; distype = SEQUENT; vptr = dsstmp+9; -@@ -1427,7 +1424,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1427,7 +1391,7 @@ jmp_buf wcspih_abort_jmp_env; } ^PLTDECD" " { @@ -30558,7 +35952,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+10; -@@ -1439,7 +1436,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1439,7 +1403,7 @@ jmp_buf wcspih_abort_jmp_env; } ^PLTDECM" " { @@ -30567,7 +35961,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+11; -@@ -1451,7 +1448,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1451,7 +1415,7 @@ jmp_buf wcspih_abort_jmp_env; } ^PLTDECS" " { @@ -30576,7 +35970,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = SEQUENT; vptr = dsstmp+12; -@@ -1463,7 +1460,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1463,7 +1427,7 @@ jmp_buf wcspih_abort_jmp_env; } ^PLATEID" " { @@ -30585,7 +35979,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = STRING; distype = SEQUENT; vptr = dsstmp+13; -@@ -1475,7 +1472,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1475,7 +1439,7 @@ jmp_buf wcspih_abort_jmp_env; } ^AMDX { @@ -30594,7 +35988,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l i = 1; dssflag = 3; -@@ -1484,7 +1481,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1484,7 +1448,7 @@ jmp_buf wcspih_abort_jmp_env; } ^AMDY { @@ -30603,7 +35997,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l i = 2; dssflag = 3; -@@ -1493,7 +1490,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1493,7 +1457,7 @@ jmp_buf wcspih_abort_jmp_env; } ^WAT[12]_{Z3} { @@ -30612,7 +36006,18 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l sscanf(yytext, "WAT%d_%d", &i, &m); if (watn < m) watn = m; watflag = 1; -@@ -1539,13 +1536,13 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1510,8 +1474,8 @@ jmp_buf wcspih_abort_jmp_env; + } + + ^END" "{77} { +- if (wcspih_nkeyrec) { +- wcspih_nkeyrec = 0; ++ if (yyextra->nkeyrec) { ++ yyextra->nkeyrec = 0; + errmsg = "keyrecords following the END keyrecord were ignored"; + BEGIN(ERROR); + } else { +@@ -1539,13 +1503,13 @@ jmp_buf wcspih_abort_jmp_env; 0{I1}{ALT} | 0{Z1}{I1} { if (relax & WCSHDR_reject) { @@ -30628,7 +36033,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l BEGIN(DISCARD); } } -@@ -1559,27 +1556,27 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1559,27 +1523,27 @@ jmp_buf wcspih_abort_jmp_env; {Z1}{ALT}" " | {Z2}{ALT} | {Z3} { @@ -30661,7 +36066,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l BEGIN(DISCARD); } } -@@ -1625,7 +1622,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1625,7 +1589,7 @@ jmp_buf wcspih_abort_jmp_env; BEGIN(ERROR); } else { @@ -30670,7 +36075,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l BEGIN(DISCARD); } } -@@ -1640,8 +1637,8 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1640,8 +1604,8 @@ jmp_buf wcspih_abort_jmp_env; {Z3}_{Z2} | {Z2}_{Z3} | {Z1}_{Z4} { @@ -30681,7 +36086,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l errmsg = "axis number must exceed 0"; BEGIN(ERROR); } -@@ -1663,7 +1660,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1663,7 +1627,7 @@ jmp_buf wcspih_abort_jmp_env; } {Z2}{I1}{Z2}{I1} { @@ -30690,7 +36095,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l if (((altlin == 1) && (relax & WCSHDR_PC00i00j)) || ((altlin == 2) && (relax & WCSHDR_CD00i00j))) { sscanf(yytext, "%3d%3d", &i, &j); -@@ -1678,7 +1675,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1678,7 +1642,7 @@ jmp_buf wcspih_abort_jmp_env; BEGIN(ERROR); } else { @@ -30699,7 +36104,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l BEGIN(DISCARD); } } -@@ -1701,14 +1698,14 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1701,14 +1665,14 @@ jmp_buf wcspih_abort_jmp_env; . { if (relax & WCSHDR_reject) { @@ -30716,7 +36121,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l BEGIN(DISCARD); } } -@@ -1753,7 +1750,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1753,7 +1717,7 @@ jmp_buf wcspih_abort_jmp_env; BEGIN(ERROR); } else { @@ -30725,7 +36130,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l BEGIN(DISCARD); } } -@@ -1768,8 +1765,8 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1768,8 +1732,8 @@ jmp_buf wcspih_abort_jmp_env; {Z3}_{Z2} | {Z2}_{Z3} | {Z1}_{Z4} { @@ -30736,7 +36141,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l errmsg = "axis number must exceed 0"; BEGIN(ERROR); } -@@ -1813,7 +1810,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1813,7 +1777,7 @@ jmp_buf wcspih_abort_jmp_env; BEGIN(ERROR); } else { @@ -30745,7 +36150,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l BEGIN(DISCARD); } } -@@ -1856,7 +1853,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1856,7 +1820,7 @@ jmp_buf wcspih_abort_jmp_env; {Z1}_{Z1}" " | {Z1}_{Z1}" " { @@ -30754,7 +36159,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = PRIOR; vptr = &(distem.dp); -@@ -1876,7 +1873,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1876,7 +1840,7 @@ jmp_buf wcspih_abort_jmp_env; {I1}" " | {I2}" " { @@ -30763,7 +36168,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l valtype = FLOAT; distype = SEQUENT; vptr = &(distem.dp); -@@ -1894,9 +1891,9 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1894,9 +1858,9 @@ jmp_buf wcspih_abort_jmp_env; } =" "+{STRING} { @@ -30775,7 +36180,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l sscanf(yytext, "= '%s", strtmp); dbltmp = strcmp(strtmp, "-") ? 1.0 : -1.0; } -@@ -1909,7 +1906,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1909,7 +1873,7 @@ jmp_buf wcspih_abort_jmp_env; } =" "+ { @@ -30784,7 +36189,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l if (99 < i || 99 < j || 99 < m) { if (relax & WCSHDR_reject) { if (99 < i || 99 < j) { -@@ -1920,7 +1917,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1920,7 +1884,7 @@ jmp_buf wcspih_abort_jmp_env; BEGIN(ERROR); } else { @@ -30793,7 +36198,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l BEGIN(DISCARD); } -@@ -1954,7 +1951,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1954,7 +1918,7 @@ jmp_buf wcspih_abort_jmp_env; BEGIN(COMMENT); } else { @@ -30802,7 +36207,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l sscanf(yytext, "%d", &inttmp); BEGIN(COMMENT); -@@ -1971,7 +1968,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1971,7 +1935,7 @@ jmp_buf wcspih_abort_jmp_env; BEGIN(COMMENT); } else { @@ -30811,7 +36216,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l wcsutil_str2double(yytext, &dbltmp); if (chekval && chekval(dbltmp)) { -@@ -1993,7 +1990,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -1993,7 +1957,7 @@ jmp_buf wcspih_abort_jmp_env; BEGIN(COMMENT); } else { @@ -30820,7 +36225,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l wcsutil_str2double2(yytext, dbl2tmp); BEGIN(COMMENT); -@@ -2010,10 +2007,10 @@ jmp_buf wcspih_abort_jmp_env; +@@ -2010,12 +1974,12 @@ jmp_buf wcspih_abort_jmp_env; BEGIN(COMMENT); } else { @@ -30829,11 +36234,15 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l strcpy(strtmp, yytext+1); - /* Squeeze out repeated quotes. */ +- ix = 0; +- for (jx = 0; jx < 72; jx++) { + // Squeeze out repeated quotes. - ix = 0; - for (jx = 0; jx < 72; jx++) { ++ int ix = 0; ++ for (int jx = 0; jx < 72; jx++) { if (ix < jx) { -@@ -2097,16 +2094,16 @@ jmp_buf wcspih_abort_jmp_env; + strtmp[ix] = strtmp[jx]; + } +@@ -2097,16 +2061,16 @@ jmp_buf wcspih_abort_jmp_env; {INLINE}$ { if (ipass == 1) { @@ -30844,31 +36253,36 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l } else if (*wcs) { - /* Store the value now that the keyrecord has been validated. */ -+ // Store the value now that the keyrecord has been validated. - gotone = 0; - for (ialt = 0; ialt < *nwcs; ialt++) { +- gotone = 0; +- for (ialt = 0; ialt < *nwcs; ialt++) { - /* The loop here is for keywords that apply */ - /* to every alternate; these have a == 0. */ ++ // Store the value now that the keyrecord has been validated. ++ int gotone = 0; ++ for (int ialt = 0; ialt < *nwcs; ialt++) { + // The loop here is for keywords that apply + // to every alternate; these have a == 0. if (a >= 'A') { ialt = alts[a-'A'+1]; if (ialt < 0) break; -@@ -2115,11 +2112,11 @@ jmp_buf wcspih_abort_jmp_env; +@@ -2115,11 +2079,12 @@ jmp_buf wcspih_abort_jmp_env; if (vptr) { if (sipflag) { - /* Translate a SIP keyword into DPja. */ +- disp = (*wcs)->lin.dispre; +- ipx = (disp->ndp)++; + // Translate a SIP keyword into DPja. - disp = (*wcs)->lin.dispre; - ipx = (disp->ndp)++; ++ struct disprm *disp = (*wcs)->lin.dispre; ++ int ipx = (disp->ndp)++; - /* SIP doesn't have alternates. */ + // SIP doesn't have alternates. ++ char keyword[16]; sprintf(keyword, "DP%d", i); sprintf(strtmp, "SIP.%s.%d_%d", (sipflag==2)?"FWD":"REV", p, q); -@@ -2130,27 +2127,27 @@ jmp_buf wcspih_abort_jmp_env; +@@ -2130,27 +2095,28 @@ jmp_buf wcspih_abort_jmp_env; } } else if (dssflag) { @@ -30888,11 +36302,14 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l - /* Translate a DSS keyword into DQia. */ + // Translate a DSS keyword into DQia. if (m <= 13 || dbltmp != 0.0) { - disp = (*wcs)->lin.disseq; - ipx = (disp->ndp)++; +- disp = (*wcs)->lin.disseq; +- ipx = (disp->ndp)++; ++ struct disprm *disp = (*wcs)->lin.disseq; ++ int ipx = (disp->ndp)++; - /* DSS doesn't have alternates. */ + // DSS doesn't have alternates. ++ char keyword[16]; sprintf(keyword, "DQ%d", i); sprintf(strtmp, "DSS.AMD.%d", m); dpfill(disp->dp+ipx, keyword, strtmp, i, 1, 0, dbltmp); @@ -30902,7 +36319,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l if (m <= 3) { dsstmp[13+(i-1)*3+m] = dbltmp; } -@@ -2158,32 +2155,32 @@ jmp_buf wcspih_abort_jmp_env; +@@ -2158,32 +2124,35 @@ jmp_buf wcspih_abort_jmp_env; } } else if (watflag) { @@ -30912,12 +36329,17 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l } else { - /* An "ordinary" keyword. */ +- wcsp = *wcs + ialt; + // An "ordinary" keyword. - wcsp = *wcs + ialt; ++ struct wcsprm *wcsp = *wcs + ialt; ++ struct disprm *disp; ++ void *wptr; ++ ptrdiff_t voff; if (auxprm) { - /* Additional auxiliary parameter. */ +- auxp = wcsp->aux; + // Additional auxiliary parameter. - auxp = wcsp->aux; ++ struct auxprm *auxp = wcsp->aux; voff = (char *)vptr - (char *)(&auxtem); wptr = (void *)((char *)auxp + voff); @@ -30942,16 +36364,19 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l voff = (char *)vptr - (char *)(&wcstem); wptr = (void *)((char *)wcsp + voff); } -@@ -2192,7 +2189,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -2192,9 +2161,9 @@ jmp_buf wcspih_abort_jmp_env; *((int *)wptr) = inttmp; } else if (valtype == FLOAT) { - /* Apply keyword parameterization. */ + // Apply keyword parameterization. if (npptr == npv) { - ipx = (wcsp->npv)++; +- ipx = (wcsp->npv)++; ++ int ipx = (wcsp->npv)++; wcsp->pv[ipx].i = i; -@@ -2213,14 +2210,14 @@ jmp_buf wcspih_abort_jmp_env; + wcsp->pv[ipx].m = m; + wptr = &(wcsp->pv[ipx].value); +@@ -2213,14 +2182,14 @@ jmp_buf wcspih_abort_jmp_env; *((double *)wptr) = dbltmp; } @@ -30968,16 +36393,44 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l if (special) { special(wptr, dbl2tmp); } else { -@@ -2229,7 +2226,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -2229,9 +2198,9 @@ jmp_buf wcspih_abort_jmp_env; } } else if (valtype == STRING) { - /* Apply keyword parameterization. */ + // Apply keyword parameterization. if (npptr == nps) { - ipx = (wcsp->nps)++; +- ipx = (wcsp->nps)++; ++ int ipx = (wcsp->nps)++; wcsp->ps[ipx].i = i; -@@ -2312,7 +2309,7 @@ jmp_buf wcspih_abort_jmp_env; + wcsp->ps[ipx].m = m; + wptr = wcsp->ps[ipx].value; +@@ -2244,12 +2213,13 @@ jmp_buf wcspih_abort_jmp_env; + wptr = *((char (**)[72])wptr) + (i - 1); + } + +- cptr = (char *)wptr; ++ char *cptr = (char *)wptr; + strcpy(cptr, strtmp); + + } else if (valtype == RECORD) { +- ipx = (disp->ndp)++; ++ int ipx = (disp->ndp)++; + ++ char keyword[16]; + if (a == ' ') { + sprintf(keyword, "%.2s%d", keyname, i); + } else { +@@ -2270,7 +2240,7 @@ jmp_buf wcspih_abort_jmp_env; + if (ctrl == 4) { + if (distran || dssflag) { + wcsfprintf(stderr, "%.80s\n Accepted (%d) as a " +- "recognised WCS convention.\n", keyrec, nvalid); ++ "recognized WCS convention.\n", keyrec, nvalid); + } else { + wcsfprintf(stderr, "%.80s\n Accepted (%d) as a " + "valid WCS keyrecord.\n", keyrec, nvalid); +@@ -2312,7 +2282,7 @@ jmp_buf wcspih_abort_jmp_env; .*$ { if (ipass == npass) { if (ctrl < 0) { @@ -30986,7 +36439,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l keep = keyrec; } else if (2 < ctrl) { -@@ -2329,7 +2326,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -2329,7 +2299,7 @@ jmp_buf wcspih_abort_jmp_env; (*nreject)++; if (ctrl%10 == -1) { @@ -30995,7 +36448,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l keep = keyrec; } -@@ -2351,7 +2348,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -2351,7 +2321,7 @@ jmp_buf wcspih_abort_jmp_env; naux += auxprm; @@ -31004,27 +36457,87 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l i = j = 0; m = 0; a = ' '; -@@ -2376,7 +2373,7 @@ jmp_buf wcspih_abort_jmp_env; +@@ -2376,7 +2346,8 @@ jmp_buf wcspih_abort_jmp_env; } <> { - /* End-of-input. */ + // End-of-input. ++ int status; if (ipass == 1) { if ((status = wcspih_init1(naxis, alts, dpq, npv, nps, ndp, ndq, naux, distran, nwcs, wcs)) || -@@ -2467,8 +2464,8 @@ void wcspih_pass1( +@@ -2401,8 +2372,8 @@ jmp_buf wcspih_abort_jmp_env; + } + + if (ipass++ < npass) { +- wcspih_hdr = header; +- wcspih_nkeyrec = nkeyrec; ++ yyextra->hdr = header; ++ yyextra->nkeyrec = nkeyrec; + keyrec = header; + *nreject = 0; + +@@ -2451,6 +2422,35 @@ jmp_buf wcspih_abort_jmp_env; + %% + + /*---------------------------------------------------------------------------- ++* External interface to the scanner. ++*---------------------------------------------------------------------------*/ ++ ++int wcspih( ++ char *header, ++ int nkeyrec, ++ int relax, ++ int ctrl, ++ int *nreject, ++ int *nwcs, ++ struct wcsprm **wcs) ++ ++{ ++ // Function prototypes. ++ int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner); ++ int yylex_destroy(yyscan_t yyscanner); ++ ++ struct wcspih_extra extra; ++ yyscan_t yyscanner; ++ yylex_init_extra(&extra, &yyscanner); ++ int status = wcspih_scanner(header, nkeyrec, relax, ctrl, nreject, nwcs, ++ wcs, yyscanner); ++ yylex_destroy(yyscanner); ++ ++ return status; ++} ++ ++ ++/*---------------------------------------------------------------------------- + * Determine the number of coordinate representations (up to 27) and the + * number of coordinate axes in each, which distortions are present, and the + * number of PVi_ma, PSi_ma, DPja, and DQia keywords in each representation. +@@ -2467,26 +2467,24 @@ void wcspih_pass1( int *npptr) { - /* On the first pass alts[] is used to determine the number of axes */ - /* for each of the 27 possible alternate coordinate descriptions. */ +- int ialt, *ip; +- + // On the first pass alts[] is used to determine the number of axes + // for each of the 27 possible alternate coordinate descriptions. - int ialt, *ip; - if (a == 0) { -@@ -2486,7 +2483,7 @@ void wcspih_pass1( + return; + } + +- ialt = 0; ++ int ialt = 0; + if (a != ' ') { + ialt = a - 'A' + 1; + } + +- ip = alts + ialt; ++ int *ip = alts + ialt; + + if (*ip < naxis) { *ip = naxis; } @@ -31033,7 +36546,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l if (*ip < i) { *ip = i; } -@@ -2495,10 +2492,10 @@ void wcspih_pass1( +@@ -2495,10 +2493,10 @@ void wcspih_pass1( *ip = j; } @@ -31046,17 +36559,24 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l if (npptr) { npptr[ialt]++; } -@@ -2528,37 +2525,37 @@ int wcspih_init1( - struct wcsprm *wcsp; - struct disprm *dis; +@@ -2524,115 +2522,115 @@ int wcspih_init1( + struct wcsprm **wcs) + + { +- int ialt, defaults, ndis, ndpmax, npsmax, npvmax, status = 0; +- struct wcsprm *wcsp; +- struct disprm *dis; ++ int status = 0; - /* Find the number of coordinate descriptions. */ + // Find the number of coordinate descriptions. *nwcs = 0; - for (ialt = 0; ialt < 27; ialt++) { +- for (ialt = 0; ialt < 27; ialt++) { ++ for (int ialt = 0; ialt < 27; ialt++) { if (alts[ialt]) (*nwcs)++; } ++ int defaults; if ((defaults = !(*nwcs) && naxis)) { - /* NAXIS is non-zero but there were no WCS keywords with an alternate - version code; create a default WCS with blank alternate version. */ @@ -31073,7 +36593,8 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l return WCSHDRERR_MEMORY; } - ndis = 0; +- ndis = 0; ++ int ndis = 0; if (distran == SIP) { - /* DPja.NAXES and DPja.OFFSET.j to be added for SIP (see below and - wcspih_final()). */ @@ -31088,11 +36609,20 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l } - /* Initialize each wcsprm struct. */ +- wcsp = *wcs; + // Initialize each wcsprm struct. - wcsp = *wcs; ++ struct wcsprm *wcsp = *wcs; *nwcs = 0; - for (ialt = 0; ialt < 27; ialt++) { -@@ -2571,30 +2568,30 @@ int wcspih_init1( +- for (ialt = 0; ialt < 27; ialt++) { ++ for (int ialt = 0; ialt < 27; ialt++) { + if (alts[ialt]) { + wcsp->flag = -1; +- npvmax = npv[ialt]; +- npsmax = nps[ialt]; ++ int npvmax = npv[ialt]; ++ int npsmax = nps[ialt]; + if ((status = wcsinit(1, alts[ialt], wcsp, npvmax, npsmax, -1))) { + wcsvfree(nwcs, wcs); break; } @@ -31118,26 +36648,39 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l - /* Any distortions present? */ + // Any distortions present? ++ struct disprm *disp; if (dpq[ialt] & 1) { - if ((dis = calloc(1, sizeof(struct disprm))) == 0x0) { +- if ((dis = calloc(1, sizeof(struct disprm))) == 0x0) { ++ if ((disp = calloc(1, sizeof(struct disprm))) == 0x0) { return WCSHDRERR_MEMORY; } - /* Attach it to linprm. Also inits it. */ + // Attach it to linprm. Also inits it. ndis++; - ndpmax = ndp[ialt]; - dis->flag = -1; -@@ -2606,33 +2603,33 @@ int wcspih_init1( +- ndpmax = ndp[ialt]; +- dis->flag = -1; +- lindist(1, &(wcsp->lin), dis, ndpmax); ++ int ndpmax = ndp[ialt]; ++ disp->flag = -1; ++ lindist(1, &(wcsp->lin), disp, ndpmax); + } + + if (dpq[ialt] & 2) { +- if ((dis = calloc(1, sizeof(struct disprm))) == 0x0) { ++ if ((disp = calloc(1, sizeof(struct disprm))) == 0x0) { return WCSHDRERR_MEMORY; } - /* Attach it to linprm. Also inits it. */ + // Attach it to linprm. Also inits it. ndis++; - ndpmax = ndq[ialt]; - dis->flag = -1; - lindist(2, &(wcsp->lin), dis, ndpmax); +- ndpmax = ndq[ialt]; +- dis->flag = -1; +- lindist(2, &(wcsp->lin), dis, ndpmax); ++ int ndpmax = ndq[ialt]; ++ disp->flag = -1; ++ lindist(2, &(wcsp->lin), disp, ndpmax); } - /* On the second pass alts[] indexes the array of wcsprm structs. */ @@ -31169,7 +36712,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l (*wcs)->lin.dispre->ndp = 6; dpfill((*wcs)->lin.dispre->dp, "DP1", "NAXES", 0, 0, 2, 0.0); dpfill((*wcs)->lin.dispre->dp+3, "DP2", "NAXES", 0, 0, 2, 0.0); -@@ -2641,7 +2638,7 @@ int wcspih_init1( +@@ -2641,7 +2639,7 @@ int wcspih_init1( strcpy((*wcs)->lin.disseq->dtype[0], "DSS"); strcpy((*wcs)->lin.disseq->dtype[1], "DSS"); @@ -31178,7 +36721,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l (*wcs)->lin.disseq->ndp = 2; dpfill((*wcs)->lin.disseq->dp, "DQ1", "NAXES", 0, 0, 2, 0.0); dpfill((*wcs)->lin.disseq->dp+1, "DQ2", "NAXES", 0, 0, 2, 0.0); -@@ -2659,7 +2656,7 @@ int wcspih_init1( +@@ -2659,7 +2657,7 @@ int wcspih_init1( int wcspih_jdref(double *mjdref, const double *jdref) { @@ -31187,7 +36730,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l if (undefined(mjdref[0] && undefined(mjdref[1]))) { mjdref[0] = jdref[0] - 2400000.0; mjdref[1] = jdref[1] - 0.5; -@@ -2676,7 +2673,7 @@ int wcspih_jdref(double *mjdref, const d +@@ -2676,7 +2674,7 @@ int wcspih_jdref(double *mjdref, const d int wcspih_jdrefi(double *mjdref, const double *jdrefi) { @@ -31196,7 +36739,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l if (undefined(mjdref[0])) { mjdref[0] = *jdrefi - 2400000.5; } -@@ -2688,7 +2685,7 @@ int wcspih_jdrefi(double *mjdref, const +@@ -2688,7 +2686,7 @@ int wcspih_jdrefi(double *mjdref, const int wcspih_jdreff(double *mjdref, const double *jdreff) { @@ -31205,7 +36748,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l if (undefined(mjdref[1])) { mjdref[1] = *jdreff; } -@@ -2704,7 +2701,7 @@ int wcspih_jdreff(double *mjdref, const +@@ -2704,7 +2702,7 @@ int wcspih_jdreff(double *mjdref, const int wcspih_epoch(double *equinox, const double *epoch) { @@ -31214,24 +36757,39 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l if (undefined(*equinox)) { *equinox = *epoch; } -@@ -2722,9 +2719,9 @@ int wcspih_vsource(double *zsource, cons +@@ -2720,12 +2718,12 @@ int wcspih_epoch(double *equinox, const + int wcspih_vsource(double *zsource, const double *vsource) + { - double beta, c = 299792458.0; +- double beta, c = 299792458.0; ++ const double c = 299792458.0; - /* If ZSOURCEa is currently undefined then set it from VSOURCEa. */ + // If ZSOURCEa is currently undefined then set it from VSOURCEa. if (undefined(*zsource)) { - /* Convert relativistic Doppler velocity to redshift. */ +- beta = *vsource/c; + // Convert relativistic Doppler velocity to redshift. - beta = *vsource/c; ++ double beta = *vsource/c; *zsource = (1.0 + beta)/sqrt(1.0 - beta*beta) - 1.0; } -@@ -2766,23 +2763,23 @@ int wcspih_final( - struct wcsprm *wcsp; - for (ialt = 0; ialt < *nwcs; ialt++) { +@@ -2758,58 +2756,52 @@ int wcspih_final( + struct wcsprm **wcs) + + { +- char field[32], *wp, wpoly[12], wtype[8]; +- int i, ialt, idp, ipv, m, npv, n, nterms, omax, omin, status, wctrl[4]; +- double A1, A2, A3, B1, B2, B3, CNPIX1, CNPIX2, *crval, Rx, Ry, S, wval, +- X0, Y0, Xc, Yc; +- struct disprm *disp; +- struct wcsprm *wcsp; +- +- for (ialt = 0; ialt < *nwcs; ialt++) { - /* Interpret -TAB header keywords. */ ++ for (int ialt = 0; ialt < *nwcs; ialt++) { + // Interpret -TAB header keywords. ++ int status; if ((status = wcstab(*wcs+ialt))) { wcsvfree(nwcs, wcs); return status; @@ -31247,26 +36805,72 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l } - /* Translated distortion functions; apply only to the primary WCS. */ +- wcsp = *wcs; + // Translated distortion functions; apply only to the primary WCS. - wcsp = *wcs; ++ struct wcsprm *wcsp = *wcs; if (distran == SIP) { - /* SIP doesn't have alternates, nor axis mapping. */ +- disp = wcsp->lin.dispre; + // SIP doesn't have alternates, nor axis mapping. - disp = wcsp->lin.dispre; ++ struct disprm *disp = wcsp->lin.dispre; dpfill(disp->dp+1, "DP1", "OFFSET.1", 0, 1, 0, wcsp->crpix[0]); dpfill(disp->dp+2, "DP1", "OFFSET.2", 0, 1, 0, wcsp->crpix[1]); -@@ -2790,8 +2787,8 @@ int wcspih_final( + dpfill(disp->dp+4, "DP2", "OFFSET.1", 0, 1, 0, wcsp->crpix[0]); dpfill(disp->dp+5, "DP2", "OFFSET.2", 0, 1, 0, wcsp->crpix[1]); } else if (distran == DSS) { - /* DSS doesn't have alternates, nor axis mapping. This translation */ - /* follows Paper IV, Sect. 5.2 using the same variable names. */ +- CNPIX1 = dsstmp[0]; +- CNPIX2 = dsstmp[1]; +- +- Xc = dsstmp[2]/1000.0; +- Yc = dsstmp[3]/1000.0; +- Rx = dsstmp[4]/1000.0; +- Ry = dsstmp[5]/1000.0; +- +- A1 = dsstmp[14]; +- A2 = dsstmp[15]; +- A3 = dsstmp[16]; +- B1 = dsstmp[17]; +- B2 = dsstmp[18]; +- B3 = dsstmp[19]; +- S = sqrt(fabs(A1*B1 - A2*B2)); + // DSS doesn't have alternates, nor axis mapping. This translation + // follows Paper IV, Sect. 5.2 using the same variable names. - CNPIX1 = dsstmp[0]; - CNPIX2 = dsstmp[1]; ++ double CNPIX1 = dsstmp[0]; ++ double CNPIX2 = dsstmp[1]; ++ ++ double Xc = dsstmp[2]/1000.0; ++ double Yc = dsstmp[3]/1000.0; ++ double Rx = dsstmp[4]/1000.0; ++ double Ry = dsstmp[5]/1000.0; ++ ++ double A1 = dsstmp[14]; ++ double A2 = dsstmp[15]; ++ double A3 = dsstmp[16]; ++ double B1 = dsstmp[17]; ++ double B2 = dsstmp[18]; ++ double B3 = dsstmp[19]; ++ double S = sqrt(fabs(A1*B1 - A2*B2)); -@@ -2833,17 +2830,17 @@ int wcspih_final( +- X0 = (A2*B3 - A3*B1) / (A1*B1 - A2*B2); +- Y0 = (A3*B2 - A1*B3) / (A1*B1 - A2*B2); ++ double X0 = (A2*B3 - A3*B1) / (A1*B1 - A2*B2); ++ double Y0 = (A3*B2 - A1*B3) / (A1*B1 - A2*B2); + + wcsp->crpix[0] = (Xc - X0)/Rx - (CNPIX1 - 0.5); + wcsp->crpix[1] = (Yc + Y0)/Ry - (CNPIX2 - 0.5); +@@ -2823,7 +2815,7 @@ int wcspih_final( + wcsp->cdelt[0] = -S/3600.0; + wcsp->cdelt[1] = S/3600.0; + +- crval = wcsp->crval; ++ double *crval = wcsp->crval; + crval[0] = (dsstmp[6] + (dsstmp[7] + dsstmp[8] /60.0)/60.0)*15.0; + crval[1] = dsstmp[10] + (dsstmp[11] + dsstmp[12]/60.0)/60.0; + if (dsstmp[9] == -1.0) crval[1] *= -1.0; +@@ -2833,19 +2825,23 @@ int wcspih_final( sprintf(wcsp->wcsname, "DSS PLATEID %.4s", (char *)(dsstmp+13)); @@ -31279,15 +36883,23 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l } else if (distran == WAT) { - /* TNX and ZPX don't have alternates, nor axis mapping. */ +- disp = wcsp->lin.disseq; + // TNX and ZPX don't have alternates, nor axis mapping. - disp = wcsp->lin.disseq; ++ char *wp; ++ int omax, omin, wctrl[4]; ++ double wval; ++ struct disprm *disp = wcsp->lin.disseq; - /* Disassemble the core dump stored in the WATi_m strings. */ +- nterms = 0; + // Disassemble the core dump stored in the WATi_m strings. - nterms = 0; ++ int i, nterms = 0; for (i = 0; i < 2; i++) { ++ char wtype[8]; sscanf(wat[i], "wtype=%s", wtype); -@@ -2853,22 +2850,22 @@ int wcspih_final( + + if (strcmp(wtype, "tnx") == 0) { +@@ -2853,22 +2849,23 @@ int wcspih_final( } else if (strcmp(wtype, "zpx") == 0) { strcpy(disp->dtype[i], "WAT-ZPX"); } else { @@ -31302,9 +36914,11 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l if (i == 1 && strcmp(wtype, "zpx") == 0) { - /* Take those on the second (latitude) axis ignoring the other. */ - /* First we have to count them and allocate space in wcsprm. */ +- wp = wat[i]; + // Take those on the second (latitude) axis ignoring the other. + // First we have to count them and allocate space in wcsprm. - wp = wat[i]; ++ wp = wat[i]; ++ int npv; for (npv = 0; npv < 30; npv++) { if ((wp = strstr(wp, "projp")) == 0x0) break; wp += 5; @@ -31315,16 +36929,22 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l if (npv) { wcsp->npvmax += npv; wcsp->pv = realloc(wcsp->pv, wcsp->npvmax*sizeof(struct pvcard)); -@@ -2879,7 +2876,7 @@ int wcspih_final( +@@ -2879,11 +2876,12 @@ int wcspih_final( wcsp->m_pv = wcsp->pv; } - /* Copy the values. */ + // Copy the values. wp = wat[i]; - for (ipv = wcsp->npv; ipv < wcsp->npvmax; ipv++) { +- for (ipv = wcsp->npv; ipv < wcsp->npvmax; ipv++) { ++ for (int ipv = wcsp->npv; ipv < wcsp->npvmax; ipv++) { if ((wp = strstr(wp, "projp")) == 0x0) break; -@@ -2895,7 +2892,7 @@ int wcspih_final( + ++ int m; + sscanf(wp, "projp%d=%lf", &m, &wval); + wcsp->pv[ipv].i = 2; + wcsp->pv[ipv].m = m; +@@ -2895,13 +2893,13 @@ int wcspih_final( wcsp->npv += npv; } @@ -31333,7 +36953,14 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l if ((wp = strchr(wat[i], '"')) == 0x0) { return WCSHDRERR_PARSER; } -@@ -2909,24 +2906,24 @@ int wcspih_final( + wp++; + +- for (m = 0; m < 4; m++) { ++ for (int m = 0; m < 4; m++) { + sscanf(wp, "%d", wctrl+m); + if ((wp = strchr(wp, ' ')) == 0x0) { + return WCSHDRERR_PARSER; +@@ -2909,24 +2907,24 @@ int wcspih_final( wp++; } @@ -31363,13 +36990,14 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l ndq[0] += 2*(1 + 1 + 4) + nterms; disp->ndpmax += ndq[0]; -@@ -2938,12 +2935,12 @@ int wcspih_final( +@@ -2938,18 +2936,18 @@ int wcspih_final( disp->m_dp = disp->dp; - /* Populate dpkeys. */ +- idp = disp->ndp; + // Populate dpkeys. - idp = disp->ndp; ++ int idp = disp->ndp; for (i = 0; i < 2; i++) { dpfill(disp->dp+(idp++), "DQ", "NAXES", i+1, 0, 2, 0.0); @@ -31378,12 +37006,20 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l if ((wp = strchr(wat[i], '"')) == 0x0) { return WCSHDRERR_PARSER; } -@@ -2957,23 +2954,23 @@ int wcspih_final( + wp++; + +- for (m = 0; m < 4; m++) { ++ for (int m = 0; m < 4; m++) { + sscanf(wp, "%d", wctrl+m); + if ((wp = strchr(wp, ' ')) == 0x0) { + return WCSHDRERR_PARSER; +@@ -2957,24 +2955,26 @@ int wcspih_final( wp++; } - /* Polynomial type. */ + // Polynomial type. ++ char wpoly[12]; dpfill(disp->dp+(idp++), "DQ", "WAT.POLY", i+1, 0, wctrl[0], 0.0); if (wctrl[0] == 1) { - /* Chebyshev polynomial. */ @@ -31404,29 +37040,36 @@ Index: astropy-4.2/cextern/wcslib/C/wcspih.l } - /* Read the scaling parameters. */ +- for (m = 0; m < 4; m++) { + // Read the scaling parameters. - for (m = 0; m < 4; m++) { ++ char field[40]; ++ for (int m = 0; m < 4; m++) { sscanf(wp, "%lf", &wval); sprintf(field, "WAT.%c%s", (m<2)?'X':'Y', (m%2)?"MAX":"MIN"); -@@ -2985,7 +2982,7 @@ int wcspih_final( + dpfill(disp->dp+(idp++), "DQ", field, i+1, 1, 0, wval); +@@ -2985,9 +2985,9 @@ int wcspih_final( wp++; } - /* Read the coefficients. */ +- for (n = 0; n < wctrl[2]; n++) { +- for (m = 0; m < wctrl[1]; m++) { + // Read the coefficients. - for (n = 0; n < wctrl[2]; n++) { - for (m = 0; m < wctrl[1]; m++) { ++ for (int n = 0; n < wctrl[2]; n++) { ++ for (int m = 0; m < wctrl[1]; m++) { if (wctrl[3] == 0) { -Index: astropy-4.2/cextern/wcslib/C/wcsprintf.c + if (m && n) continue; + } else if (wctrl[3] == 2) { +Index: astropy-4.2.1/cextern/wcslib/C/wcsprintf.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcsprintf.c -+++ astropy-4.2/cextern/wcslib/C/wcsprintf.c +--- astropy-4.2.1.orig/cextern/wcslib/C/wcsprintf.c ++++ astropy-4.2.1/cextern/wcslib/C/wcsprintf.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -31440,7 +37083,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsprintf.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsprintf.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcsprintf.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcsprintf.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -31565,16 +37208,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcsprintf.c wcsprintf_size += 1024; realloc_buff = realloc(wcsprintf_buff, wcsprintf_size); if (realloc_buff == NULL) { -Index: astropy-4.2/cextern/wcslib/C/wcsprintf.h +Index: astropy-4.2.1/cextern/wcslib/C/wcsprintf.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcsprintf.h -+++ astropy-4.2/cextern/wcslib/C/wcsprintf.h +--- astropy-4.2.1.orig/cextern/wcslib/C/wcsprintf.h ++++ astropy-4.2.1/cextern/wcslib/C/wcsprintf.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -31588,11 +37231,11 @@ Index: astropy-4.2/cextern/wcslib/C/wcsprintf.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsprintf.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcsprintf.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcsprintf.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * @@ -31602,16 +37245,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcsprintf.h -#endif /* WCSLIB_WCSPRINTF */ +#endif // WCSLIB_WCSPRINTF -Index: astropy-4.2/cextern/wcslib/C/wcstrig.c +Index: astropy-4.2.1/cextern/wcslib/C/wcstrig.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcstrig.c -+++ astropy-4.2/cextern/wcslib/C/wcstrig.c +--- astropy-4.2.1.orig/cextern/wcslib/C/wcstrig.c ++++ astropy-4.2.1/cextern/wcslib/C/wcstrig.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -31625,7 +37268,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcstrig.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcstrig.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcstrig.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcstrig.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -31692,16 +37335,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcstrig.c double atan2d(double y, double x) -Index: astropy-4.2/cextern/wcslib/C/wcstrig.h +Index: astropy-4.2.1/cextern/wcslib/C/wcstrig.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcstrig.h -+++ astropy-4.2/cextern/wcslib/C/wcstrig.h +--- astropy-4.2.1.orig/cextern/wcslib/C/wcstrig.h ++++ astropy-4.2.1/cextern/wcslib/C/wcstrig.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -31715,11 +37358,11 @@ Index: astropy-4.2/cextern/wcslib/C/wcstrig.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcstrig.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcstrig.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcstrig.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * @@ -31759,16 +37402,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcstrig.h -#endif /* WCSLIB_WCSTRIG */ +#endif // WCSLIB_WCSTRIG -Index: astropy-4.2/cextern/wcslib/C/wcsulex.l +Index: astropy-4.2.1/cextern/wcslib/C/wcsulex.l =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcsulex.l -+++ astropy-4.2/cextern/wcslib/C/wcsulex.l +--- astropy-4.2.1.orig/cextern/wcslib/C/wcsulex.l ++++ astropy-4.2.1/cextern/wcslib/C/wcsulex.l @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -31782,27 +37425,57 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsulex.l,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcsulex.l,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcsulex.l,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * * wcsulex.l is a Flex description file containing the definition of a -@@ -98,7 +95,7 @@ static int wcsulex_scanner(const char un - double units[WCSUNITS_NTYPE], struct wcserr **err, - yyscan_t yyscanner); +@@ -44,6 +41,7 @@ + %option outfile="wcsulex.c" + %option prefix="wcsulex" + %option reentrant ++%option extra-type="struct wcsulex_extra *" + + /* Exponents. */ + INTEGER [+-]?[1-9][0-9]* +@@ -94,81 +92,64 @@ ADD_UNIT {ADD_ALL}|{ADD_SUP}|{ADD_SUB}| + #include "wcsunits.h" + #include "wcsutil.h" + +-static int wcsulex_scanner(const char unitstr[], int *func, double *scale, +- double units[WCSUNITS_NTYPE], struct wcserr **err, +- yyscan_t yyscanner); +- +-/*--------------------------------------------------------------------------*/ +- +-int wcsulexe( +- const char unitstr[], +- int *func, +- double *scale, +- double units[WCSUNITS_NTYPE], +- struct wcserr **err) +- +-{ +- int status; +- yyscan_t yyscanner; +- int yylex_init(yyscan_t *yyscanner); +- int yylex_destroy(yyscan_t yyscanner); +- +- yylex_init(&yyscanner); +- status = wcsulex_scanner(unitstr, func, scale, units, err, yyscanner); +- yylex_destroy(yyscanner); +- +- return status; +-} ++// User data associated with yyscanner. ++struct wcsulex_extra { ++ // Used in preempting the call to exit() by yy_fatal_error(). ++ jmp_buf abort_jmp_env; ++}; -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- - - int wcsulexe( - const char unitstr[], -@@ -120,16 +117,16 @@ int wcsulexe( - return status; - } - --/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- - - #define YY_DECL int wcsulex_scanner(const char unitstr[], int *func, \ +- +-#define YY_DECL int wcsulex_scanner(const char unitstr[], int *func, \ ++#define YY_DECL int wcsulexe_scanner(const char unitstr[], int *func, \ double *scale, double units[WCSUNITS_NTYPE], struct wcserr **err, \ yyscan_t yyscanner) @@ -31811,13 +37484,58 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l #define YY_INPUT(inbuff, count, bufsize) { count = YY_NULL; } -/* Used in preempting the call to exit() by yy_fatal_error(). */ -+// Used in preempting the call to exit() by yy_fatal_error(). - jmp_buf wcsulex_abort_jmp_env; - #define exit(status) longjmp(wcsulex_abort_jmp_env, status) +-jmp_buf wcsulex_abort_jmp_env; +-#define exit(status) longjmp(wcsulex_abort_jmp_env, status) ++// Preempt the call to exit() by yy_fatal_error(). ++#define exit(status) longjmp(yyextra->abort_jmp_env, status); ++ ++// Internal helper functions. ++static YY_DECL; -@@ -160,14 +157,14 @@ jmp_buf wcsulex_abort_jmp_env; - factor = 1.0; - *scale = 1.0; + %} + + %% +- static const char *function = "wcsulexe"; ++ static const char *function = "wcsulexe_scanner"; + +- char ctmp[72]; +- int bracket = 0; +- int operator = 0; +- int paren = 0; +- int status = 0; +- int func_r, i, j; +- double dexp, expon, factor, factor_r, types[WCSUNITS_NTYPE]; +- YY_BUFFER_STATE buf; + void add(double *factor, double types[], double *expon, double *scale, + double units[]); + +- if (err) *err = 0x0; ++ // Initialise returned values. ++ *func = 0; ++ *scale = 1.0; + +- *func = 0; +- for (i = 0; i < WCSUNITS_NTYPE; i++) { ++ for (int i = 0; i < WCSUNITS_NTYPE; i++) { + units[i] = 0.0; ++ } ++ ++ if (err) *err = 0x0; ++ ++ double types[WCSUNITS_NTYPE]; ++ for (int i = 0; i < WCSUNITS_NTYPE; i++) { + types[i] = 0.0; + } +- expon = 1.0; +- factor = 1.0; +- *scale = 1.0; ++ double expon = 1.0; ++ double factor = 1.0; ++ ++ int bracket = 0; ++ int operator = 0; ++ int paren = 0; ++ int status = 0; - /* Avert a flex-induced memory leak. */ + // Avert a flex-induced memory leak. @@ -31828,11 +37546,13 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l yy_scan_string(unitstr, yyscanner); - /* Return here via longjmp() invoked by yy_fatal_error(). */ +- if (setjmp(wcsulex_abort_jmp_env)) { + // Return here via longjmp() invoked by yy_fatal_error(). - if (setjmp(wcsulex_abort_jmp_env)) { ++ if (setjmp(yyextra->abort_jmp_env)) { return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR), "Internal units parser error parsing '%s'", unitstr); -@@ -180,7 +177,7 @@ jmp_buf wcsulex_abort_jmp_env; + } +@@ -180,7 +161,7 @@ jmp_buf wcsulex_abort_jmp_env; #endif ^" "+ { @@ -31841,7 +37561,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l yy_set_bol(1); } -@@ -222,13 +219,13 @@ jmp_buf wcsulex_abort_jmp_env; +@@ -222,13 +203,13 @@ jmp_buf wcsulex_abort_jmp_env; } ^[*.] { @@ -31857,7 +37577,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l sqrt" "*"(" { expon /= 2.0; -@@ -237,7 +234,7 @@ sqrt" "*"(" { +@@ -237,7 +218,7 @@ sqrt" "*"(" { } "(" { @@ -31866,7 +37586,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l yyless(0); BEGIN(PAREN); } -@@ -291,11 +288,11 @@ sqrt" "*"(" { +@@ -291,15 +272,18 @@ sqrt" "*"(" { ")" { paren--; if (paren) { @@ -31879,8 +37599,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l + // Balanced; strip off the outer parentheses and recurse. yytext[yyleng-1] = '\0'; - buf = YY_CURRENT_BUFFER; -@@ -421,125 +418,125 @@ sqrt" "*"(" { +- buf = YY_CURRENT_BUFFER; ++ int func_r; ++ double factor_r; + status = wcsulexe(yytext+1, &func_r, &factor_r, types, err); ++ ++ YY_BUFFER_STATE buf = YY_CURRENT_BUFFER; + yy_switch_to_buffer(buf, yyscanner); + + if (func_r) { +@@ -421,125 +405,125 @@ sqrt" "*"(" { } . { @@ -32025,7 +37753,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l factor *= 1e-29 / 3.0; types[WCSUNITS_CHARGE] += 1.0; types[WCSUNITS_LENGTH] += 1.0; -@@ -547,20 +544,20 @@ sqrt" "*"(" { +@@ -547,20 +531,20 @@ sqrt" "*"(" { } d { @@ -32049,7 +37777,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l factor *= 1e-7; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; -@@ -569,7 +566,7 @@ sqrt" "*"(" { +@@ -569,7 +553,7 @@ sqrt" "*"(" { } eV { @@ -32058,7 +37786,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l factor *= 1.6021765e-19; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; -@@ -578,7 +575,7 @@ sqrt" "*"(" { +@@ -578,7 +562,7 @@ sqrt" "*"(" { } F { @@ -32067,7 +37795,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l types[WCSUNITS_MASS] -= 1.0; types[WCSUNITS_LENGTH] -= 2.0; types[WCSUNITS_TIME] += 3.0; -@@ -587,7 +584,7 @@ sqrt" "*"(" { +@@ -587,7 +571,7 @@ sqrt" "*"(" { } G { @@ -32076,7 +37804,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l factor *= 1e-4; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_TIME] += 1.0; -@@ -596,14 +593,14 @@ sqrt" "*"(" { +@@ -596,14 +580,14 @@ sqrt" "*"(" { } g { @@ -32093,7 +37821,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] += 2.0; -@@ -612,20 +609,20 @@ sqrt" "*"(" { +@@ -612,20 +596,20 @@ sqrt" "*"(" { } h { @@ -32117,7 +37845,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 2.0; -@@ -633,7 +630,7 @@ sqrt" "*"(" { +@@ -633,7 +617,7 @@ sqrt" "*"(" { } Jy { @@ -32126,7 +37854,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l factor *= 1e-26; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_TIME] -= 2.0; -@@ -641,20 +638,20 @@ sqrt" "*"(" { +@@ -641,20 +625,20 @@ sqrt" "*"(" { } K { @@ -32150,7 +37878,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l types[WCSUNITS_LUMINTEN] += 1.0; types[WCSUNITS_SOLID_ANGLE] += 1.0; types[WCSUNITS_LENGTH] -= 2.0; -@@ -662,46 +659,46 @@ sqrt" "*"(" { +@@ -662,46 +646,46 @@ sqrt" "*"(" { } lyr { @@ -32204,7 +37932,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 1.0; types[WCSUNITS_TIME] -= 2.0; -@@ -709,7 +706,7 @@ sqrt" "*"(" { +@@ -709,7 +693,7 @@ sqrt" "*"(" { } [Oo]hm { @@ -32213,7 +37941,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 1.0; -@@ -718,7 +715,7 @@ sqrt" "*"(" { +@@ -718,7 +702,7 @@ sqrt" "*"(" { } Pa { @@ -32222,7 +37950,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] -= 1.0; types[WCSUNITS_TIME] -= 2.0; -@@ -726,26 +723,26 @@ sqrt" "*"(" { +@@ -726,26 +710,26 @@ sqrt" "*"(" { } pc { @@ -32253,7 +37981,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l factor *= 1e10 / (4.0 * PI); types[WCSUNITS_LENGTH] -= 2.0; types[WCSUNITS_TIME] -= 1.0; -@@ -754,14 +751,14 @@ sqrt" "*"(" { +@@ -754,14 +738,14 @@ sqrt" "*"(" { } rad { @@ -32270,7 +37998,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l factor *= 13.605692 * 1.6021765e-19; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; -@@ -770,7 +767,7 @@ sqrt" "*"(" { +@@ -770,7 +754,7 @@ sqrt" "*"(" { } S { @@ -32279,7 +38007,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l types[WCSUNITS_MASS] -= 1.0; types[WCSUNITS_LENGTH] -= 2.0; types[WCSUNITS_TIME] += 1.0; -@@ -779,13 +776,13 @@ sqrt" "*"(" { +@@ -779,13 +763,13 @@ sqrt" "*"(" { } s { @@ -32295,7 +38023,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l factor *= 3.8268e26; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; -@@ -794,33 +791,33 @@ sqrt" "*"(" { +@@ -794,33 +778,33 @@ sqrt" "*"(" { } solMass { @@ -32334,7 +38062,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_TIME] += 1.0; types[WCSUNITS_CHARGE] -= 1.0; -@@ -828,21 +825,21 @@ sqrt" "*"(" { +@@ -828,21 +812,21 @@ sqrt" "*"(" { } turn { @@ -32359,7 +38087,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 1.0; types[WCSUNITS_TIME] -= 2.0; -@@ -851,13 +848,13 @@ sqrt" "*"(" { +@@ -851,13 +835,13 @@ sqrt" "*"(" { } voxel { @@ -32375,7 +38103,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 3.0; -@@ -865,7 +862,7 @@ sqrt" "*"(" { +@@ -865,7 +849,7 @@ sqrt" "*"(" { } Wb { @@ -32384,7 +38112,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] += 1.0; -@@ -874,14 +871,14 @@ sqrt" "*"(" { +@@ -874,20 +858,21 @@ sqrt" "*"(" { } . { @@ -32401,7 +38129,40 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l if (operator++) { BEGIN(FLUSH); } -@@ -921,7 +918,7 @@ sqrt" "*"(" { + } + + " "*{INTEGER} { ++ int i; + sscanf(yytext, " %d", &i); + expon *= (double)i; + add(&factor, types, &expon, scale, units); +@@ -896,6 +881,7 @@ sqrt" "*"(" { + } + + " "*"("" "*{INTEGER}" "*")" { ++ int i; + sscanf(yytext, " (%d)", &i); + expon *= (double)i; + add(&factor, types, &expon, scale, units); +@@ -904,6 +890,7 @@ sqrt" "*"(" { + } + + " "*"("" "*{FRAC}" "*")" { ++ int i, j; + sscanf(yytext, " (%d/%d)", &i, &j); + expon *= (double)i / (double)j; + add(&factor, types, &expon, scale, units); +@@ -912,7 +899,9 @@ sqrt" "*"(" { + } + + " "*"("" "*{FLOAT}" "*")" { ++ char ctmp[72]; + sscanf(yytext, " (%s)", ctmp); ++ double dexp; + wcsutil_str2double(ctmp, &dexp); + expon *= dexp; + add(&factor, types, &expon, scale, units); +@@ -921,7 +910,7 @@ sqrt" "*"(" { } " "*[.*]" "* { @@ -32410,7 +38171,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l if (operator++) { BEGIN(FLUSH); } else { -@@ -931,7 +928,7 @@ sqrt" "*"(" { +@@ -931,7 +920,7 @@ sqrt" "*"(" { } " "*"(" { @@ -32419,7 +38180,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l if (operator) { BEGIN(FLUSH); } else { -@@ -942,7 +939,7 @@ sqrt" "*"(" { +@@ -942,7 +931,7 @@ sqrt" "*"(" { } " "+ { @@ -32428,7 +38189,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l if (operator) { BEGIN(FLUSH); } else { -@@ -952,7 +949,7 @@ sqrt" "*"(" { +@@ -952,7 +941,7 @@ sqrt" "*"(" { } " "*"/"" "* { @@ -32437,7 +38198,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l if (operator++) { BEGIN(FLUSH); } else { -@@ -975,11 +972,11 @@ sqrt" "*"(" { +@@ -975,11 +964,11 @@ sqrt" "*"(" { } .* { @@ -32451,16 +38212,73 @@ Index: astropy-4.2/cextern/wcslib/C/wcsulex.l if (YY_START == EXPON) { add(&factor, types, &expon, scale, units); } -Index: astropy-4.2/cextern/wcslib/C/wcsunits.c +@@ -1003,7 +992,7 @@ sqrt" "*"(" { + } + + if (status) { +- for (i = 0; i < WCSUNITS_NTYPE; i++) { ++ for (int i = 0; i < WCSUNITS_NTYPE; i++) { + units[i] = 0.0; + *scale = 0.0; + } +@@ -1015,6 +1004,34 @@ sqrt" "*"(" { + %% + + /*---------------------------------------------------------------------------- ++* External interface to the scanner. ++*---------------------------------------------------------------------------*/ ++ ++int wcsulexe( ++ const char unitstr[], ++ int *func, ++ double *scale, ++ double units[WCSUNITS_NTYPE], ++ struct wcserr **err) ++ ++{ ++ static const char *function = "wcsulexe"; ++ ++ // Function prototypes. ++ int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner); ++ int yylex_destroy(yyscan_t yyscanner); ++ ++ struct wcsulex_extra extra; ++ yyscan_t yyscanner; ++ yylex_init_extra(&extra, &yyscanner); ++ int status = wcsulexe_scanner(unitstr, func, scale, units, err, yyscanner); ++ yylex_destroy(yyscanner); ++ ++ return status; ++} ++ ++ ++/*---------------------------------------------------------------------------- + * Accumulate a term in a units specification and reset work variables. + *---------------------------------------------------------------------------*/ + +@@ -1026,11 +1043,9 @@ void add( + double units[]) + + { +- int i; +- + *scale *= pow(*factor, *expon); + +- for (i = 0; i < WCSUNITS_NTYPE; i++) { ++ for (int i = 0; i < WCSUNITS_NTYPE; i++) { + units[i] += *expon * types[i]; + types[i] = 0.0; + } +Index: astropy-4.2.1/cextern/wcslib/C/wcsunits.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcsunits.c -+++ astropy-4.2/cextern/wcslib/C/wcsunits.c +--- astropy-4.2.1.orig/cextern/wcslib/C/wcsunits.c ++++ astropy-4.2.1/cextern/wcslib/C/wcsunits.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -32474,7 +38292,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsunits.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsunits.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcsunits.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcsunits.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -32603,16 +38421,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcsunits.c int wcsulex(const char unitstr[], int *func, double *scale, double units[]) -Index: astropy-4.2/cextern/wcslib/C/wcsunits.h +Index: astropy-4.2.1/cextern/wcslib/C/wcsunits.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcsunits.h -+++ astropy-4.2/cextern/wcslib/C/wcsunits.h +--- astropy-4.2.1.orig/cextern/wcslib/C/wcsunits.h ++++ astropy-4.2.1/cextern/wcslib/C/wcsunits.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -32626,11 +38444,11 @@ Index: astropy-4.2/cextern/wcslib/C/wcsunits.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsunits.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcsunits.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcsunits.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * @@ -32765,16 +38583,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcsunits.h -#endif /* WCSLIB_WCSUNITS */ +#endif // WCSLIB_WCSUNITS -Index: astropy-4.2/cextern/wcslib/C/wcsutil.c +Index: astropy-4.2.1/cextern/wcslib/C/wcsutil.c =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcsutil.c -+++ astropy-4.2/cextern/wcslib/C/wcsutil.c +--- astropy-4.2.1.orig/cextern/wcslib/C/wcsutil.c ++++ astropy-4.2.1/cextern/wcslib/C/wcsutil.c @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -32788,7 +38606,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutil.c Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsutil.c,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcsutil.c,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcsutil.c,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *===========================================================================*/ #include @@ -32801,47 +38619,91 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutil.c void wcsdealloc(void *ptr) -@@ -45,7 +42,7 @@ void wcsdealloc(void *ptr) +@@ -45,74 +42,71 @@ void wcsdealloc(void *ptr) return; } -/*--------------------------------------------------------------------------*/ +//---------------------------------------------------------------------------- - void wcsutil_strcvt(int n, char c, const char src[], char dst[]) +-void wcsutil_strcvt(int n, char c, const char src[], char dst[]) ++void wcsutil_strcvt(int n, char c, int nt, const char src[], char dst[]) -@@ -64,7 +61,7 @@ void wcsutil_strcvt(int n, char c, const - return; - } + { +- int j; +- + if (n <= 0) return; + if (c != '\0') c = ' '; + + if (src == 0x0) { + if (dst) { +- memset(dst, c, n); ++ memset(dst, c, n); + } + +- return; +- } +- - /* Copy to the first NULL character. */ -+ // Copy to the first NULL character. - for (j = 0; j < n; j++) { - if ((dst[j] = src[j]) == '\0') { - break; -@@ -72,18 +69,18 @@ void wcsutil_strcvt(int n, char c, const +- for (j = 0; j < n; j++) { +- if ((dst[j] = src[j]) == '\0') { +- break; ++ } else { ++ // Copy to the first NULL character. ++ int j; ++ for (j = 0; j < n; j++) { ++ if ((dst[j] = src[j]) == '\0') { ++ break; ++ } + } +- } +- +- if (j < n) { +- /* The given string is null-terminated. */ +- memset(dst+j, c, n-j); + +- } else { +- /* The given string is not null-terminated. */ +- if (c == '\0') { +- j = n - 1; +- dst[j] = '\0'; +- +- j--; +- +- /* Work backwards, looking for the first non-blank. */ +- for (; j >= 0; j--) { +- if (dst[j] != ' ') { +- break; ++ if (j < n) { ++ // The given string is null-terminated. ++ memset(dst+j, c, n-j); ++ ++ } else { ++ // The given string is not null-terminated. ++ if (c == '\0') { ++ // Work backwards, looking for the first non-blank. ++ for (j = n - 1; j >= 0; j--) { ++ if (dst[j] != ' ') { ++ break; ++ } + } +- } + +- j++; +- memset(dst+j, '\0', n-j); ++ j++; ++ if (j == n && !nt) { ++ dst[n-1] = '\0'; ++ } else { ++ memset(dst+j, '\0', n-j); ++ } ++ } + } } - if (j < n) { -- /* The given string is null-terminated. */ -+ // The given string is null-terminated. - memset(dst+j, c, n-j); - - } else { -- /* The given string is not null-terminated. */ -+ // The given string is not null-terminated. - if (c == '\0') { - j = n - 1; - dst[j] = '\0'; - - j--; - -- /* Work backwards, looking for the first non-blank. */ -+ // Work backwards, looking for the first non-blank. - for (; j >= 0; j--) { - if (dst[j] != ' ') { - break; -@@ -98,7 +95,7 @@ void wcsutil_strcvt(int n, char c, const ++ if (nt) dst[n] = '\0'; ++ return; } @@ -32850,16 +38712,23 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutil.c void wcsutil_blank_fill(int n, char c[]) -@@ -111,7 +108,7 @@ void wcsutil_blank_fill(int n, char c[]) + { +- int j; +- + if (n <= 0) return; + + if (c == 0x0) { return; } - /* Replace the terminating null and all successive characters. */ +- for (j = 0; j < n; j++) { + // Replace the terminating null and all successive characters. - for (j = 0; j < n; j++) { ++ for (int j = 0; j < n; j++) { if (c[j] == '\0') { memset(c+j, ' ', n-j); -@@ -122,7 +119,7 @@ void wcsutil_blank_fill(int n, char c[]) + break; +@@ -122,33 +116,32 @@ void wcsutil_blank_fill(int n, char c[]) return; } @@ -32868,12 +38737,18 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutil.c void wcsutil_null_fill(int n, char c[]) -@@ -135,20 +132,20 @@ void wcsutil_null_fill(int n, char c[]) + { +- int j; +- + if (n <= 0) return; + + if (c == 0x0) { return; } - /* Find the first NULL character. */ + // Find the first NULL character. ++ int j; for (j = 0; j < n; j++) { if (c[j] == '\0') { break; @@ -32892,65 +38767,179 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutil.c j--; for (; j > 0; j--) { if (c[j] != ' ') { -@@ -163,7 +160,7 @@ void wcsutil_null_fill(int n, char c[]) +@@ -163,174 +156,211 @@ void wcsutil_null_fill(int n, char c[]) return; } -/*--------------------------------------------------------------------------*/ +//---------------------------------------------------------------------------- - int wcsutil_allEq(int nvec, int nelem, const double *first) +-int wcsutil_allEq(int nvec, int nelem, const double *first) ++int wcsutil_all_ival(int nelem, int ival, const int iarr[]) ++ ++{ ++ for (int i = 0; i < nelem; i++) { ++ if (iarr[i] != ival) return 0; ++ } ++ ++ return 1; ++} ++ ++//---------------------------------------------------------------------------- ++ ++int wcsutil_all_dval(int nelem, double dval, const double darr[]) ++ ++{ ++ for (int i = 0; i < nelem; i++) { ++ if (darr[i] != dval) return 0; ++ } ++ ++ return 1; ++} ++ ++//---------------------------------------------------------------------------- ++ ++int wcsutil_all_sval(int nelem, const char *sval, const char (*sarr)[72]) + + { +- double v0; +- const double *vp; ++ for (int i = 0; i < nelem; i++) { ++ if (strncmp(sarr[i], sval, 72)) return 0; ++ } + ++ return 1; ++} ++ ++//---------------------------------------------------------------------------- ++ ++int wcsutil_allEq(int nvec, int nelem, const double *first) ++ ++{ + if (nvec <= 0 || nelem <= 0) return 0; + +- v0 = *first; +- for (vp = first+nelem; vp < first + nvec*nelem; vp += nelem) { ++ double v0 = *first; ++ for (const double *vp = first+nelem; vp < first + nvec*nelem; vp += nelem) { + if (*vp != v0) return 0; + } -@@ -181,7 +178,7 @@ int wcsutil_allEq(int nvec, int nelem, c return 1; } -/*--------------------------------------------------------------------------*/ +//---------------------------------------------------------------------------- - int wcsutil_Eq(int nelem, double tol, const double *arr1, const double *arr2) +-int wcsutil_Eq(int nelem, double tol, const double *arr1, const double *arr2) ++int wcsutil_dblEq( ++ int nelem, ++ double tol, ++ const double *darr1, ++ const double *darr2) -@@ -195,18 +192,18 @@ int wcsutil_Eq(int nelem, double tol, co - if (arr1 == 0x0 || arr2 == 0x0) return 0; + { +- int i; +- + if (nelem == 0) return 1; + if (nelem < 0) return 0; + +- if (arr1 == 0x0 && arr2 == 0x0) return 1; +- if (arr1 == 0x0 || arr2 == 0x0) return 0; ++ if (darr1 == 0x0 && darr2 == 0x0) return 1; if (tol == 0.0) { - /* Handled separately for speed of execution. */ +- for (i = 0; i < nelem; i++, arr1++, arr2++) { +- if (*arr1 != *arr2) return 0; + // Handled separately for speed of execution. - for (i = 0; i < nelem; i++, arr1++, arr2++) { - if (*arr1 != *arr2) return 0; ++ for (int i = 0; i < nelem; i++) { ++ double dval1 = (darr1 ? darr1[i] : UNDEFINED); ++ double dval2 = (darr2 ? darr2[i] : UNDEFINED); ++ ++ // Undefined values must match exactly. ++ if (dval1 == UNDEFINED && dval2 != UNDEFINED) return 0; ++ if (dval1 != UNDEFINED && dval2 == UNDEFINED) return 0; ++ ++ if (dval1 != dval2) return 0; } } else { - for (i = 0; i < nelem; i++, arr1++, arr2++) { +- for (i = 0; i < nelem; i++, arr1++, arr2++) { - /* Undefined values must match exactly. */ +- if (*arr1 == UNDEFINED && *arr2 != UNDEFINED) return 0; +- if (*arr1 != UNDEFINED && *arr2 == UNDEFINED) return 0; ++ for (int i = 0; i < nelem; i++) { ++ double dval1 = (darr1 ? darr1[i] : UNDEFINED); ++ double dval2 = (darr2 ? darr2[i] : UNDEFINED); ++ + // Undefined values must match exactly. - if (*arr1 == UNDEFINED && *arr2 != UNDEFINED) return 0; - if (*arr1 != UNDEFINED && *arr2 == UNDEFINED) return 0; ++ if (dval1 == UNDEFINED && dval2 != UNDEFINED) return 0; ++ if (dval1 != UNDEFINED && dval2 == UNDEFINED) return 0; - /* Otherwise, compare within the specified tolerance. */ +- if (fabs(*arr1 - *arr2) > 0.5*tol) return 0; + // Otherwise, compare within the specified tolerance. - if (fabs(*arr1 - *arr2) > 0.5*tol) return 0; ++ if (fabs(dval1 - dval2) > 0.5*tol) return 0; } } -@@ -214,7 +211,7 @@ int wcsutil_Eq(int nelem, double tol, co + return 1; } -/*--------------------------------------------------------------------------*/ +//---------------------------------------------------------------------------- - int wcsutil_intEq(int nelem, const int *arr1, const int *arr2) +-int wcsutil_intEq(int nelem, const int *arr1, const int *arr2) ++int wcsutil_intEq(int nelem, const int *iarr1, const int *iarr2) + + { +- int i; +- + if (nelem == 0) return 1; + if (nelem < 0) return 0; + +- if (arr1 == 0x0 && arr2 == 0x0) return 1; +- if (arr1 == 0x0 || arr2 == 0x0) return 0; ++ if (iarr1 == 0x0 && iarr2 == 0x0) return 1; ++ ++ for (int i = 0; i < nelem; i++) { ++ int ival1 = (iarr1 ? iarr1[i] : 0); ++ int ival2 = (iarr2 ? iarr2[i] : 0); + +- for (i = 0; i < nelem; i++, arr1++, arr2++) { +- if (*arr1 != *arr2) return 0; ++ if (ival1 != ival2) return 0; + } -@@ -234,7 +231,7 @@ int wcsutil_intEq(int nelem, const int * return 1; } -/*--------------------------------------------------------------------------*/ +//---------------------------------------------------------------------------- - int wcsutil_strEq(int nelem, char (*arr1)[72], char (*arr2)[72]) +-int wcsutil_strEq(int nelem, char (*arr1)[72], char (*arr2)[72]) ++int wcsutil_strEq(int nelem, char (*sarr1)[72], char (*sarr2)[72]) + + { +- int i; +- + if (nelem == 0) return 1; + if (nelem < 0) return 0; + +- if (arr1 == 0x0 && arr2 == 0x0) return 1; +- if (arr1 == 0x0 || arr2 == 0x0) return 0; ++ if (sarr1 == 0x0 && sarr2 == 0x0) return 1; ++ ++ for (int i = 0; i < nelem; i++) { ++ char *sval1 = (sarr1 ? sarr1[i] : ""); ++ char *sval2 = (sarr2 ? sarr2[i] : ""); + +- for (i = 0; i < nelem; i++, arr1++, arr2++) { +- if (strncmp(*arr1, *arr2, 72)) return 0; ++ if (strncmp(sval1, sval2, 72)) return 0; + } -@@ -254,7 +251,7 @@ int wcsutil_strEq(int nelem, char (*arr1 return 1; } @@ -32959,7 +38948,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutil.c void wcsutil_setAll(int nvec, int nelem, double *first) -@@ -269,7 +266,7 @@ void wcsutil_setAll(int nvec, int nelem, + { +- double v0, *vp; +- + if (nvec <= 0 || nelem <= 0) return; + +- v0 = *first; +- for (vp = first+nelem; vp < first + nvec*nelem; vp += nelem) { ++ double v0 = *first; ++ for (double *vp = first+nelem; vp < first + nvec*nelem; vp += nelem) { + *vp = v0; } } @@ -32968,7 +38966,16 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutil.c void wcsutil_setAli(int nvec, int nelem, int *first) -@@ -284,7 +281,7 @@ void wcsutil_setAli(int nvec, int nelem, + { +- int v0, *vp; +- + if (nvec <= 0 || nelem <= 0) return; + +- v0 = *first; +- for (vp = first+nelem; vp < first + nvec*nelem; vp += nelem) { ++ int v0 = *first; ++ for (int *vp = first+nelem; vp < first + nvec*nelem; vp += nelem) { + *vp = v0; } } @@ -32977,20 +38984,24 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutil.c void wcsutil_setBit(int nelem, const int *sel, int bits, int *array) -@@ -294,20 +291,20 @@ void wcsutil_setBit(int nelem, const int + { +- int *arrp; +- if (bits == 0 || nelem <= 0) return; if (sel == 0x0) { - /* All elements selected. */ +- for (arrp = array; arrp < array + nelem; arrp++) { + // All elements selected. - for (arrp = array; arrp < array + nelem; arrp++) { ++ for (int *arrp = array; arrp < array + nelem; arrp++) { *arrp |= bits; } } else { - /* Some elements selected. */ +- for (arrp = array; arrp < array + nelem; arrp++) { + // Some elements selected. - for (arrp = array; arrp < array + nelem; arrp++) { ++ for (int *arrp = array; arrp < array + nelem; arrp++) { if (*(sel++)) *arrp |= bits; } } @@ -33001,30 +39012,38 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutil.c char *wcsutil_fptr2str(void (*fptr)(void), char hext[19]) -@@ -317,11 +314,11 @@ char *wcsutil_fptr2str(void (*fptr)(void - unsigned int i; - int *(ip[2]), j[2], le = 1, gotone = 0; - + { +- unsigned char *p = (unsigned char *)(&fptr); +- char *t = hext; +- unsigned int i; +- int *(ip[2]), j[2], le = 1, gotone = 0; +- - /* Test for little-endian addresses. */ + // Test for little-endian addresses. ++ int *(ip[2]), j[2], le = 1; ip[0] = j; ip[1] = j + 1; ++ unsigned char *p = (unsigned char *)(&fptr); if ((unsigned char *)ip[0] < (unsigned char *)ip[1]) { - /* Little-endian, reverse it. */ + // Little-endian, reverse it. p += sizeof(fptr) - 1; le = -1; } -@@ -330,7 +327,7 @@ char *wcsutil_fptr2str(void (*fptr)(void + ++ char *t = hext; + sprintf(t, "0x0"); t += 2; - for (i = 0; i < sizeof(fptr); i++) { +- for (i = 0; i < sizeof(fptr); i++) { - /* Skip leading zeroes. */ ++ for (size_t i = 0; i < sizeof(fptr); i++) { + // Skip leading zeroes. ++ int gotone = 0; if (*p) gotone = 1; if (gotone) { -@@ -344,7 +341,7 @@ char *wcsutil_fptr2str(void (*fptr)(void +@@ -344,7 +374,7 @@ char *wcsutil_fptr2str(void (*fptr)(void return hext; } @@ -33033,16 +39052,23 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutil.c static void wcsutil_locale_to_dot(char *buf) -@@ -379,7 +376,7 @@ void wcsutil_double2str(char *buf, const +@@ -374,13 +404,11 @@ static void wcsutil_locale_to_dot(char * + void wcsutil_double2str(char *buf, const char *format, double value) + + { +- char *bp, *cp; +- sprintf(buf, format, value); wcsutil_locale_to_dot(buf); - /* Look for a decimal point or exponent. */ +- bp = buf; + // Look for a decimal point or exponent. - bp = buf; ++ char *bp = buf; while (*bp) { if (*bp != ' ') { -@@ -390,7 +387,7 @@ void wcsutil_double2str(char *buf, const + if (*bp == '.') return; +@@ -390,10 +418,10 @@ void wcsutil_double2str(char *buf, const bp++; } @@ -33050,8 +39076,12 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutil.c + // Not found, add a fractional part. bp = buf; if (*bp == ' ') { - cp = buf + 1; -@@ -408,7 +405,7 @@ void wcsutil_double2str(char *buf, const +- cp = buf + 1; ++ char *cp = buf + 1; + if (*cp == ' ') cp++; + + while (*cp) { +@@ -408,7 +436,7 @@ void wcsutil_double2str(char *buf, const } } @@ -33060,38 +39090,50 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutil.c static const char *wcsutil_dot_to_locale(const char *inbuf, char *outbuf) -@@ -455,7 +452,7 @@ int wcsutil_str2double2(const char *buf, +@@ -449,24 +477,24 @@ int wcsutil_str2double(const char *buf, + int wcsutil_str2double2(const char *buf, double *value) + + { +- char *cptr, ctmp[72], *dptr, *eptr, ltmp[72]; +- int exp = 0; +- value[0] = 0.0; value[1] = 0.0; - /* Get the integer part. */ + // Get the integer part. ++ char ltmp[72]; if (sscanf(wcsutil_dot_to_locale(buf, ltmp), "%lf", value) < 1) { return 1; } -@@ -463,10 +460,10 @@ int wcsutil_str2double2(const char *buf, + value[0] = floor(value[0]); ++ char ctmp[72]; strcpy(ctmp, buf); - /* Look for a decimal point. */ +- dptr = strchr(ctmp, '.'); + // Look for a decimal point. - dptr = strchr(ctmp, '.'); ++ char *dptr = strchr(ctmp, '.'); - /* Look for an exponent. */ + // Look for an exponent. ++ char *eptr; if ((eptr = strchr(ctmp, 'E')) == NULL) { if ((eptr = strchr(ctmp, 'D')) == NULL) { if ((eptr = strchr(ctmp, 'e')) == NULL) { -@@ -476,7 +473,7 @@ int wcsutil_str2double2(const char *buf, +@@ -475,8 +503,9 @@ int wcsutil_str2double2(const char *buf, + } } ++ int exp = 0; if (eptr) { - /* Get the exponent. */ + // Get the exponent. if (sscanf(eptr+1, "%d", &exp) < 1) { return 1; } -@@ -487,15 +484,15 @@ int wcsutil_str2double2(const char *buf, +@@ -487,17 +516,17 @@ int wcsutil_str2double2(const char *buf, } if (dptr+exp <= ctmp) { @@ -33108,18 +39150,21 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutil.c - /* Get the fractional part. */ + // Get the fractional part. if (dptr) { - cptr = ctmp; +- cptr = ctmp; ++ char *cptr = ctmp; while (cptr <= dptr+exp) { -Index: astropy-4.2/cextern/wcslib/C/wcsutil.h + if ('0' < *cptr && *cptr <= '9') *cptr = '0'; + cptr++; +Index: astropy-4.2.1/cextern/wcslib/C/wcsutil.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcsutil.h -+++ astropy-4.2/cextern/wcslib/C/wcsutil.h +--- astropy-4.2.1.orig/cextern/wcslib/C/wcsutil.h ++++ astropy-4.2.1/cextern/wcslib/C/wcsutil.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -33133,30 +39178,197 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutil.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsutil.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcsutil.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcsutil.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * -@@ -428,4 +425,4 @@ int wcsutil_str2double2(const char *buf +@@ -67,9 +64,10 @@ + * wcsutil_strcvt() copies one character string to another up to the specified + * maximum number of characters. + * +-* If the given string is null-terminated, then the terminating NULL character, +-* and all characters following it up to the specified maximum, are replaced +-* with the specified substitute character, either blank or NULL. ++* If the given string is null-terminated, then the NULL character copied to ++* the returned string, and all characters following it up to the specified ++* maximum, are replaced with the specified substitute character, either blank ++* or NULL. + * + * If the source string is not null-terminated and the substitute character is + * blank, then copy the maximum number of characters and do nothing further. +@@ -85,9 +83,11 @@ + * c char Substitute character, either NULL or blank (anything + * other than NULL). + * +-* src const char[] +-* Character string to be copied. Need not be +-* null-terminated. ++* nt int If true, then dst is of length n+1, with the last ++* character always set to NULL. ++* ++* src char[] Character string to be copied. If null-terminated, ++* then need not be of length n, otherwise it must be. + * + * Returned: + * dst char[] Destination character string, which must be long +@@ -142,6 +142,69 @@ + * void + * + * ++* wcsutil_all_ival() - Test if all elements an int array have a given value ++* ------------------------------------------------------------------------- ++* INTERNAL USE ONLY. ++* ++* wcsutil_all_ival() tests whether all elements of an array of type int all ++* have the specified value. ++* ++* Given: ++* nelem int The length of the array. ++* ++* ival int Value to be tested. ++* ++* iarr const int[] ++* Pointer to the first element of the array. ++* ++* Function return value: ++* int Status return value: ++* 0: Not all equal. ++* 1: All equal. ++* ++* ++* wcsutil_all_dval() - Test if all elements a double array have a given value ++* --------------------------------------------------------------------------- ++* INTERNAL USE ONLY. ++* ++* wcsutil_all_dval() tests whether all elements of an array of type double all ++* have the specified value. ++* ++* Given: ++* nelem int The length of the array. ++* ++* dval int Value to be tested. ++* ++* darr const double[] ++* Pointer to the first element of the array. ++* ++* Function return value: ++* int Status return value: ++* 0: Not all equal. ++* 1: All equal. ++* ++* ++* wcsutil_all_sval() - Test if all elements a string array have a given value ++* --------------------------------------------------------------------------- ++* INTERNAL USE ONLY. ++* ++* wcsutil_all_sval() tests whether all elements of an array of type ++* char (*)[72] all have the specified value. ++* ++* Given: ++* nelem int The length of the array. ++* ++* sval char * String to be tested. ++* ++* sarr const (*char)[72] ++* Pointer to the first element of the array. ++* ++* Function return value: ++* int Status return value: ++* 0: Not all equal. ++* 1: All equal. ++* ++* + * wcsutil_allEq() - Test for equality of a particular vector element + * ------------------------------------------------------------------ + * INTERNAL USE ONLY. +@@ -173,11 +236,11 @@ + * 1: All equal. + * + * +-* wcsutil_Eq() - Test for equality of two double arrays +-* ----------------------------------------------------- ++* wcsutil_dblEq() - Test for equality of two arrays of type double ++* ---------------------------------------------------------------- + * INTERNAL USE ONLY. + * +-* wcsutil_Eq() tests for equality of two double-precision arrays. ++* wcsutil_dblEq() tests for equality of two double-precision arrays. + * + * Given: + * nelem int The number of elements in each array. +@@ -199,8 +262,8 @@ + * 1: Equal. + * + * +-* wcsutil_intEq() - Test for equality of two int arrays +-* ----------------------------------------------------- ++* wcsutil_intEq() - Test for equality of two arrays of type int ++* ------------------------------------------------------------- + * INTERNAL USE ONLY. + * + * wcsutil_intEq() tests for equality of two int arrays. +@@ -245,7 +308,8 @@ + * -------------------------------------------------- + * INTERNAL USE ONLY. + * +-* wcsutil_setAll() sets the value of a particular element in a set of vectors. ++* wcsutil_setAll() sets the value of a particular element in a set of vectors ++* of type double. + * + * Given: + * nvec int The number of vectors. +@@ -273,7 +337,8 @@ + * -------------------------------------------------- + * INTERNAL USE ONLY. + * +-* wcsutil_setAli() sets the value of a particular element in a set of vectors. ++* wcsutil_setAli() sets the value of a particular element in a set of vectors ++* of type int. + * + * Given: + * nvec int The number of vectors. +@@ -406,14 +471,18 @@ extern "C" { + + void wcsdealloc(void *ptr); + +-void wcsutil_strcvt(int n, char c, const char src[], char dst[]); ++void wcsutil_strcvt(int n, char c, int nt, const char src[], char dst[]); + + void wcsutil_blank_fill(int n, char c[]); + void wcsutil_null_fill (int n, char c[]); + ++int wcsutil_all_ival(int nelem, int ival, const int iarr[]); ++int wcsutil_all_dval(int nelem, double dval, const double darr[]); ++int wcsutil_all_sval(int nelem, const char *sval, const char (*sarr)[72]); + int wcsutil_allEq (int nvec, int nelem, const double *first); +-int wcsutil_Eq(int nelem, double tol, const double *arr1, +- const double *arr2); ++ ++int wcsutil_dblEq(int nelem, double tol, const double *arr1, ++ const double *arr2); + int wcsutil_intEq(int nelem, const int *arr1, const int *arr2); + int wcsutil_strEq(int nelem, char (*arr1)[72], char (*arr2)[72]); + void wcsutil_setAll(int nvec, int nelem, double *first); +@@ -428,4 +497,4 @@ int wcsutil_str2double2(const char *buf } #endif -#endif /* WCSLIB_WCSUTIL */ +#endif // WCSLIB_WCSUTIL -Index: astropy-4.2/cextern/wcslib/C/wcsutrn.l +Index: astropy-4.2.1/cextern/wcslib/C/wcsutrn.l =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wcsutrn.l -+++ astropy-4.2/cextern/wcslib/C/wcsutrn.l +--- astropy-4.2.1.orig/cextern/wcslib/C/wcsutrn.l ++++ astropy-4.2.1/cextern/wcslib/C/wcsutrn.l @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -33170,25 +39382,51 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutrn.l Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsutrn.l,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wcsutrn.l,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wcsutrn.l,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * * wcsutrn.l is a Flex description file containing the definition of a lexical -@@ -59,7 +56,7 @@ - static int wcsutrne_scanner(int ctrl, char unitstr[], struct wcserr **err, - yyscan_t yyscanner); +@@ -43,6 +40,7 @@ + %option outfile="wcsutrn.c" + %option prefix="wcsutrn" + %option reentrant ++%option extra-type="struct wcsutrn_extra *" + /* Exclusive start states. */ + %x NEXT FLUSH +@@ -56,64 +54,47 @@ + #include "wcserr.h" + #include "wcsunits.h" + +-static int wcsutrne_scanner(int ctrl, char unitstr[], struct wcserr **err, +- yyscan_t yyscanner); +- -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- - - int wcsutrne( - int ctrl, -@@ -79,15 +76,15 @@ int wcsutrne( - return status; - } - +- +-int wcsutrne( +- int ctrl, +- char unitstr[], +- struct wcserr **err) +- +-{ +- int status; +- yyscan_t yyscanner; +- int yylex_init(yyscan_t *yyscanner); +- int yylex_destroy(yyscan_t yyscanner); +- +- yylex_init(&yyscanner); +- status = wcsutrne_scanner(ctrl, unitstr, err, yyscanner); +- yylex_destroy(yyscanner); +- +- return status; +-} +- -/*--------------------------------------------------------------------------*/ -+//---------------------------------------------------------------------------- ++// User data associated with yyscanner. ++struct wcsutrn_extra { ++ // Used in preempting the call to exit() by yy_fatal_error(). ++ jmp_buf abort_jmp_env; ++}; #define YY_DECL int wcsutrne_scanner(int ctrl, char unitstr[], \ struct wcserr **err, yyscan_t yyscanner) @@ -33198,20 +39436,50 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutrn.l #define YY_INPUT(inbuff, count, bufsize) { count = YY_NULL; } -/* Used in preempting the call to exit() by yy_fatal_error(). */ -+// Used in preempting the call to exit() by yy_fatal_error(). - jmp_buf wcsutrn_abort_jmp_env; - #define exit(status) longjmp(wcsutrn_abort_jmp_env, status) +-jmp_buf wcsutrn_abort_jmp_env; +-#define exit(status) longjmp(wcsutrn_abort_jmp_env, status) ++// Preempt the call to exit() by yy_fatal_error(). ++#define exit(status) longjmp(yyextra->abort_jmp_env, status); ++ ++// Internal helper functions. ++static YY_DECL; -@@ -110,7 +107,7 @@ jmp_buf wcsutrn_abort_jmp_env; + %} + + %% +- static const char *function = "wcsutrne"; +- +- char orig[80], subs[80]; +- int bracket = 0; +- int unsafe = 0; +- int status = -1; ++ static const char *function = "wcsutrne_scanner"; + + if (err) *err = 0x0; + ++ char orig[80], subs[80]; + *orig = '\0'; + *subs = '\0'; + ++ int bracket = 0; ++ int unsafe = 0; ++ int status = -1; ++ + yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner); yy_scan_string(unitstr, yyscanner); *unitstr = '\0'; - /* Return here via longjmp() invoked by yy_fatal_error(). */ +- if (setjmp(wcsutrn_abort_jmp_env)) { + // Return here via longjmp() invoked by yy_fatal_error(). - if (setjmp(wcsutrn_abort_jmp_env)) { ++ if (setjmp(yyextra->abort_jmp_env)) { return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR), - "Internal units translator error parsing '%s'", unitstr); -@@ -123,22 +120,22 @@ jmp_buf wcsutrn_abort_jmp_env; +- "Internal units translator error parsing '%s'", unitstr); ++ "Internal units translator error"); + } + + BEGIN(INITIAL); +@@ -123,22 +104,22 @@ jmp_buf wcsutrn_abort_jmp_env; #endif ^" "*"[" { @@ -33238,7 +39506,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutrn.l strcpy(orig, yytext); strcpy(subs, "Angstrom"); BEGIN(NEXT); -@@ -304,25 +301,25 @@ years?|YR|YEARS? { +@@ -304,25 +285,25 @@ years?|YR|YEARS? { } [A-Za-z]+ { @@ -33268,7 +39536,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutrn.l strcat(unitstr, subs); strcat(unitstr, " "); if (strcmp(orig, subs)) status = 0; -@@ -332,7 +329,7 @@ years?|YR|YEARS? { +@@ -332,7 +313,7 @@ years?|YR|YEARS? { } . { @@ -33277,7 +39545,7 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutrn.l strcat(unitstr, subs); if (strcmp(orig, subs)) status = 0; unput(*yytext); -@@ -341,12 +338,12 @@ years?|YR|YEARS? { +@@ -341,12 +322,12 @@ years?|YR|YEARS? { } .* { @@ -33292,16 +39560,45 @@ Index: astropy-4.2/cextern/wcslib/C/wcsutrn.l if (*subs) { strcat(unitstr, subs); if (strcmp(orig, subs)) status = 0; -Index: astropy-4.2/cextern/wcslib/C/wtbarr.h +@@ -360,3 +341,28 @@ years?|YR|YEARS? { + } + + %% ++ ++/*---------------------------------------------------------------------------- ++* External interface to the scanner. ++*---------------------------------------------------------------------------*/ ++ ++int wcsutrne( ++ int ctrl, ++ char unitstr[], ++ struct wcserr **err) ++ ++{ ++ static const char *function = "wcsutrne"; ++ ++ // Function prototypes. ++ int yylex_init_extra(YY_EXTRA_TYPE extra, yyscan_t *yyscanner); ++ int yylex_destroy(yyscan_t yyscanner); ++ ++ struct wcsutrn_extra extra; ++ yyscan_t yyscanner; ++ yylex_init_extra(&extra, &yyscanner); ++ int status = wcsutrne_scanner(ctrl, unitstr, err, yyscanner); ++ yylex_destroy(yyscanner); ++ ++ return status; ++} +Index: astropy-4.2.1/cextern/wcslib/C/wtbarr.h =================================================================== ---- astropy-4.2.orig/cextern/wcslib/C/wtbarr.h -+++ astropy-4.2/cextern/wcslib/C/wtbarr.h +--- astropy-4.2.1.orig/cextern/wcslib/C/wtbarr.h ++++ astropy-4.2.1/cextern/wcslib/C/wtbarr.h @@ -1,7 +1,6 @@ /*============================================================================ - - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -33315,11 +39612,11 @@ Index: astropy-4.2/cextern/wcslib/C/wtbarr.h Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wtbarr.h,v 7.3 2020/06/03 03:37:02 mcalabre Exp $ -+ $Id: wtbarr.h,v 7.4 2021/01/31 02:24:51 mcalabre Exp $ ++ $Id: wtbarr.h,v 7.6 2021/04/13 12:57:01 mcalabre Exp $ *============================================================================= * -* WCSLIB 7.3 - C routines that implement the FITS World Coordinate System -+* WCSLIB 7.4 - C routines that implement the FITS World Coordinate System ++* WCSLIB 7.6 - 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. * @@ -33370,11 +39667,131 @@ Index: astropy-4.2/cextern/wcslib/C/wtbarr.h -#endif /* WCSLIB_WTBARR */ +#endif // WCSLIB_WTBARR -Index: astropy-4.2/cextern/wcslib/CHANGES +Index: astropy-4.2.1/cextern/wcslib/CHANGES =================================================================== ---- astropy-4.2.orig/cextern/wcslib/CHANGES -+++ astropy-4.2/cextern/wcslib/CHANGES -@@ -1,3 +1,66 @@ +--- astropy-4.2.1.orig/cextern/wcslib/CHANGES ++++ astropy-4.2.1/cextern/wcslib/CHANGES +@@ -1,3 +1,186 @@ ++WCSLIB version 7.6 (2021/04/13) ++------------------------------- ++ ++* C library ++ ++ - Bug fix in tabs2x() triggered for 1-dimensional coordinate lookup ++ tables on axes > 1. Reported by Mihai Cara. ++ ++ - In datfix(), don't return status 0 if no change was made (fix for ++ change made at release 7.4). Reported by Derek Homeier. ++ ++ - New function wcspcx() in the wcsfix suite regularizes the linear ++ transformation component of a coordinate description to make it more ++ human-readable. It decomposes CDi_ja into PCi_ja and CDELTia in ++ such a way that CDELTia forms meaningful scaling parameters, often ++ leaving an orthogonal or near-orthogonal matrix. Optionally, it can ++ then permute rows of this matrix to unscramble axis permutations. ++ ++ A test header may be generated from wcspcx.keyrec for input to ++ wcsware (not exercised as part of the standard test suite). ++ ++ - New function wcstrim() frees memory allocated by wcsinit() for ++ arrays in a wcsprm struct that remain unused after the struct has ++ been set up. ++ ++ - New functions wcssize(), auxsize(), tabsize(), linsize(), dissize(), ++ celsize(), prjsize(), spcsize(), and wcserr_size() compute the total ++ size of the relevant structs, including allocated memory. ++ ++ - In the C test suite, inserted a brief pause in tprj2 and tspc, which ++ otherwise have now become a blur. ++ ++* Fortran wrappers ++ ++ - Added wrappers for wcspcx(), wcstrim(), wcssize(), auxsize(), ++ tabsize(), linsize(), dissize(), celsize(), prjsize(), spcsize(), ++ and wcserr_size(). ++ ++* Utilities ++ ++ - Added -c, -cp, -C, and -Cp options to wcsware to apply wcspcx() ++ in a variety of ways, -m to apply wcstrim(), and -z to report the ++ total size of the wcsprm struct with a breakdown of the sizes of ++ its constituent structs. ++ ++ - Fixed compiler warnings for sundazel (portability issue). ++ ++* Installation ++ ++ - Upped the required version of Flex to 2.6.0 (was 2.5.9). Problems ++ with Flex 2.5.39 reported by Derek Homeier. ++ ++ Also added '--disable-flex' as a new configure option to force the ++ use of the pre-generated Flex sources. ++ ++ ++WCSLIB version 7.5 (2021/03/20) ++------------------------------- ++ ++The C code in WCSLIB is moving piecemeal to the C99 standard. In fact, ++various indispensible C99 constructs have been used in WCSLIB for many ++years: the long long int data type (in fitshdr() only); stdint.h, ++inttypes.h, and the use of PRI formatting control (in wcsprintf(), which ++is widely used by the library); and the C99-extended library function ++vsnprintf() (used by wcserr for a decade). Flex-generated C code also ++uses C99 extensions, though with workarounds if they are not available. ++ ++Except in the header prologues, which are formatted in a special way for ++generating the user manual, comments were changed en masse to C99 style ++in release 7.3.1, and variable declarations in code that I have occasion ++to modify will transition to the more general placement allowed by C99. ++However, I have no plans to use any of the more esoteric features of ++C99. ++ ++* C library ++ ++ - New function, wcsccs(), changes the celestial coordinate system of a ++ wcsprm struct, for example, from equatorial to galactic coordinates. ++ The parameters that define the spherical coordinate transformation ++ must be provided. This allows WCSLIB to provide this functionality ++ without needing to know anything about specific celestial coordinate ++ systems, and has the advantage of making the routine completely ++ general. Requested by Mohammad Akhlaghi. ++ ++ Modified test program twcsfix also to test wcsccs(). ++ ++ - Fixed a problem common to all of the Flex code (fitshdr, wcsbth, ++ wcspih, wcsulex, and wcsutrn) that made it thread-unsafe. Reported ++ by Cyril Richard. ++ ++ Added a new test program, tpthreads, to test thread safety. It is ++ only used for code development, and not exercised as part of the ++ standard test suite. ++ ++ - In fitshdr(), fixed a problem that potentially could arise on ++ systems where sizeof(long long int) is greater than 8 (64 bits). ++ ++* Fortran wrappers ++ ++ - Match changes to the C library: added a wrapper for wcsccs(), and ++ modified twcsfix.f. ++ ++ - Because null addresses cannot be passed to functions in Fortran, ++ wcssub_() now interprets *nsub == -1 && *axes == -1 as a signal to ++ do a deep copy of one wcsprm struct to another. ++ ++* Utilities ++ ++ - New utility, sundazel, computes the local time of the Sun's passage ++ through the specified apparent longitude or latitude in a user- ++ defined coordinate system. It can also perform several other Solar ++ related calculations. (It is unrelated to FITS WCS, and does not ++ use WCSLIB.) ++ ++* Installation ++ ++ - Added an 'uninstall' rule to the makefiles. Suggested by ++ Cyril Richard. ++ ++ +WCSLIB version 7.4 (2021/01/31) +------------------------------- + @@ -33441,40 +39858,91 @@ Index: astropy-4.2/cextern/wcslib/CHANGES WCSLIB version 7.3 (2020/06/03) ------------------------------- -@@ -3030,4 +3093,4 @@ WCSLIB version 1.0 (1995/01/31) +@@ -3030,4 +3213,4 @@ WCSLIB version 1.0 (1995/01/31) Initial release. ------------------------------------------------------------------------ -$Id: CHANGES,v 7.3 2020/06/03 03:37:03 mcalabre Exp $ -+$Id: CHANGES,v 7.4 2021/01/31 02:24:52 mcalabre Exp $ -Index: astropy-4.2/cextern/wcslib/GNUmakefile ++$Id: CHANGES,v 7.6 2021/04/13 12:57:02 mcalabre Exp $ +Index: astropy-4.2.1/cextern/wcslib/GNUmakefile =================================================================== ---- astropy-4.2.orig/cextern/wcslib/GNUmakefile -+++ astropy-4.2/cextern/wcslib/GNUmakefile +--- astropy-4.2.1.orig/cextern/wcslib/GNUmakefile ++++ astropy-4.2.1/cextern/wcslib/GNUmakefile @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# GNU makefile for building WCSLIB 7.3 -+# GNU makefile for building WCSLIB 7.4 ++# GNU makefile for building WCSLIB 7.6 # # Summary of the main targets # --------------------------- -@@ -32,7 +32,7 @@ +@@ -8,6 +8,8 @@ + # tests: Do 'make tests' in each subdirectory (compile test programs but + # don't run them). + # install: Do 'make install' in each subdirectory. ++# uninstall: Deletes installed files (this release only), including the ++# sharable library. + # clean: Recursively delete intermediate files produced as part of the + # build, e.g. object modules, core dumps, etc. + # cleaner: Recursively clean, and also delete test executables, test +@@ -32,7 +34,7 @@ # # Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. # http://www.atnf.csiro.au/people/Mark.Calabretta -# $Id: GNUmakefile,v 7.3 2020/06/03 03:37:03 mcalabre Exp $ -+# $Id: GNUmakefile,v 7.4 2021/01/31 02:24:52 mcalabre Exp $ ++# $Id: GNUmakefile,v 7.6 2021/04/13 12:57:02 mcalabre Exp $ #----------------------------------------------------------------------------- # Get configure settings. SUBDIR := . -Index: astropy-4.2/cextern/wcslib/INSTALL +@@ -43,7 +45,7 @@ ifeq "$(CHECK)" "nopgplot" + endif + + .PHONY : build check chmod clean cleaner cleanest distclean install \ +- realclean show tests writable ++ realclean show tests uninstall writable + + build : + -@ for DIR in $(SUBDIRS) ; do \ +@@ -81,6 +83,10 @@ install : + @ for DIR in $(INSTDIR) ; do \ + $(MAKE) -k -C $$DIR $@ ; \ + done ++ if [ ! -d "$(LIBDIR)/pkgconfig" ] ; then \ ++ $(INSTALL) -d -m 775 $(LIBDIR)/pkgconfig ; \ ++ fi ++ $(INSTALL) -m 444 wcslib.pc $(LIBDIR)/pkgconfig/wcslib.pc + $(INSTALL) -m 444 wcsconfig.h wcsconfig_f77.h $(INCDIR) + - if [ ! -d "$(DOCDIR)" ] ; then \ + $(INSTALL) -d -m 775 $(DOCDIR) ; \ +@@ -98,10 +104,17 @@ install : + $(INSTALL) -d -m 775 $(HTMLDIR)/html ; \ + fi + $(INSTALL) -m 444 html/* $(HTMLDIR)/html +- if [ ! -d "$(LIBDIR)/pkgconfig" ] ; then \ +- $(INSTALL) -d -m 775 $(LIBDIR)/pkgconfig ; \ +- fi +- $(INSTALL) -m 444 wcslib.pc $(LIBDIR)/pkgconfig/wcslib.pc ++ ++uninstall : ++ @ for DIR in $(INSTDIR) ; do \ ++ $(MAKE) -k -C $$DIR $@ ; \ ++ done ++ - cd $(LIBDIR) && $(RM) pkgconfig/wcslib.pc ++ - cd $(INCDIR) && $(RM) wcsconfig*.h ++ - $(RM) $(DOCLINK) ++ - $(RM) $(DOCDIR) ++ - $(RM) $(PDFDIR) ++ - $(RM) $(HTMLDIR) + + clean cleaner : + for DIR in $(SUBDIRS) doxygen ; do \ +Index: astropy-4.2.1/cextern/wcslib/INSTALL =================================================================== ---- astropy-4.2.orig/cextern/wcslib/INSTALL -+++ astropy-4.2/cextern/wcslib/INSTALL +--- astropy-4.2.1.orig/cextern/wcslib/INSTALL ++++ astropy-4.2.1/cextern/wcslib/INSTALL @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------ -WCSLIB 7.3 and PGSBOX 7.3 INSTALLATION -+WCSLIB 7.4 and PGSBOX 7.4 INSTALLATION ++WCSLIB 7.6 and PGSBOX 7.6 INSTALLATION -------------------------------------- WCSLIB requires an ANSI C compiler with standard ANSI C environment, that is, @@ -33484,8 +39952,8 @@ Index: astropy-4.2/cextern/wcslib/INSTALL - tar pxvf wcslib-7.3.tar.bz2 - cd wcslib-7.3 -+ tar pxvf wcslib-7.4.tar.bz2 -+ cd wcslib-7.4 ++ tar pxvf wcslib-7.6.tar.bz2 ++ cd wcslib-7.6 make install Otherwise, read on. @@ -33495,8 +39963,8 @@ Index: astropy-4.2/cextern/wcslib/INSTALL - bzcat wcslib-7.3.tar.bz2 | tar pvxf - - cd wcslib-7.3 -+ bzcat wcslib-7.4.tar.bz2 | tar pvxf - -+ cd wcslib-7.4 ++ bzcat wcslib-7.6.tar.bz2 | tar pvxf - ++ cd wcslib-7.6 then if you do not need to specify any configuration options, simply run @@ -33505,22 +39973,22 @@ Index: astropy-4.2/cextern/wcslib/INSTALL Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta -$Id: INSTALL,v 7.3 2020/06/03 03:37:03 mcalabre Exp $ -+$Id: INSTALL,v 7.4 2021/01/31 02:24:52 mcalabre Exp $ ++$Id: INSTALL,v 7.6 2021/04/13 12:57:02 mcalabre Exp $ ============================================================================== -Index: astropy-4.2/cextern/wcslib/README +Index: astropy-4.2.1/cextern/wcslib/README =================================================================== ---- astropy-4.2.orig/cextern/wcslib/README -+++ astropy-4.2/cextern/wcslib/README +--- astropy-4.2.1.orig/cextern/wcslib/README ++++ astropy-4.2.1/cextern/wcslib/README @@ -1,8 +1,8 @@ ------------------------------------------------------------------------------ - WCSLIB 7.3 and PGSBOX 7.3 -+ WCSLIB 7.4 and PGSBOX 7.4 ++ WCSLIB 7.6 and PGSBOX 7.6 ------------------------------------------------------------------------------ - WCSLIB 7.3 - an implementation of the FITS WCS standard. - Copyright (C) 1995-2020, Mark Calabretta -+ WCSLIB 7.4 - an implementation of the FITS WCS standard. ++ WCSLIB 7.6 - an implementation of the FITS WCS standard. + Copyright (C) 1995-2021, Mark Calabretta This file is part of WCSLIB. @@ -33534,14 +40002,14 @@ Index: astropy-4.2/cextern/wcslib/README Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: README,v 7.3 2020/06/03 03:37:03 mcalabre Exp $ -+ $Id: README,v 7.4 2021/01/31 02:24:52 mcalabre Exp $ ++ $Id: README,v 7.6 2021/04/13 12:57:02 mcalabre Exp $ ------------------------------------------------------------------------------ Please refer to -Index: astropy-4.2/cextern/wcslib/THANKS +Index: astropy-4.2.1/cextern/wcslib/THANKS =================================================================== ---- astropy-4.2.orig/cextern/wcslib/THANKS -+++ astropy-4.2/cextern/wcslib/THANKS +--- astropy-4.2.1.orig/cextern/wcslib/THANKS ++++ astropy-4.2.1/cextern/wcslib/THANKS @@ -2,7 +2,7 @@ I would like to acknowledge the followin to WCSLIB and/or PGSBOX in some way since 1995 - via bug reports, patches, suggestions for improvements, positive feedback, etc. @@ -33585,7 +40053,14 @@ Index: astropy-4.2/cextern/wcslib/THANKS Michelle Miller (NOAO) Jessica Mink (CfA) David Motl (var.astro.cz) -@@ -86,7 +88,7 @@ Keith A. Scollick (GSFC/NASA) +@@ -80,13 +82,14 @@ Ray Plante (NCSA/UIUC) + Paul Price (Princeton U.) + Niruj Mohan Ramanujam (Leiden Obs) + Harold Ravlin (U. Illinois) ++Cyril Richard (CNRS) + Thomas Robitaille (MPIA, STScI) + Boud Roukema (TCfA) + Keith A. Scollick (GSFC/NASA) Arno Schoenmakers (ASTRON) Pim Schellart (Princeton U.) Corentin Schreiber (Oxford U.) @@ -33594,19 +40069,39 @@ Index: astropy-4.2/cextern/wcslib/THANKS Colin Slater (LSST) Hanno Spreeuw (ASTRON) Ole Streicher (Debian maintainer) -@@ -108,4 +110,4 @@ Daren Scot Wilson (NRAO) +@@ -108,4 +111,4 @@ Daren Scot Wilson (NRAO) Tony Wong (ATNF/CSIRO) -$Id: THANKS,v 7.3 2020/06/03 03:37:03 mcalabre Exp $ -+$Id: THANKS,v 7.3.1.4 2021/01/31 01:24:38 mcalabre Exp $ -Index: astropy-4.2/cextern/wcslib/VALIDATION ++$Id: THANKS,v 7.6 2021/04/13 12:57:02 mcalabre Exp $ +Index: astropy-4.2.1/cextern/wcslib/VALIDATION =================================================================== ---- astropy-4.2.orig/cextern/wcslib/VALIDATION -+++ astropy-4.2/cextern/wcslib/VALIDATION -@@ -1,5 +1,25 @@ +--- astropy-4.2.1.orig/cextern/wcslib/VALIDATION ++++ astropy-4.2.1/cextern/wcslib/VALIDATION +@@ -1,5 +1,45 @@ Platforms on which the installation procedures and test suite were exercised. ++WCSLIB version 7.6 (2021/04/13) ++------------------------------- ++ ++* Dell Latitude E6530 (Intel Core i7-3740QM, 4 cores, 8 processors, x86_64) ++ KDE Neon User Edition 5.21 (over Kubuntu 20.04, (focal)) ++ uname -r (kernel version): 5.4.0-67-generic ++ gcc --version: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 ++ gfortran --version: GNU Fortran (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 ++ ++ ++WCSLIB version 7.5 (2021/03/20) ++------------------------------- ++ ++* Dell Latitude XPS 15 9560 (Intel Core i7-7700HQ, 4 cores, 8 CPUs, x86_64) ++ KDE Neon User Edition 5.20 (over Kubuntu 20.04, (focal)) ++ uname -r (kernel version): 5.4.0-62-generic ++ gcc --version: gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 ++ gfortran --version: GNU Fortran (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 ++ ++ +WCSLIB version 7.4 (2021/01/31) +------------------------------- + @@ -33630,23 +40125,23 @@ Index: astropy-4.2/cextern/wcslib/VALIDATION WCSLIB version 7.3 (2020/06/03) ------------------------------- -@@ -626,4 +646,4 @@ WCSLIB version 4.4 (2009/08/06) +@@ -626,4 +666,4 @@ WCSLIB version 4.4 (2009/08/06) 2004/04/23 ------------------------------------------------------------------------------ -$Id: VALIDATION,v 7.3 2020/06/03 03:37:03 mcalabre Exp $ -+$Id: VALIDATION,v 7.4 2021/01/31 02:24:52 mcalabre Exp $ -Index: astropy-4.2/cextern/wcslib/configure ++$Id: VALIDATION,v 7.6 2021/04/13 12:57:02 mcalabre Exp $ +Index: astropy-4.2.1/cextern/wcslib/configure =================================================================== ---- astropy-4.2.orig/cextern/wcslib/configure -+++ astropy-4.2/cextern/wcslib/configure +--- astropy-4.2.1.orig/cextern/wcslib/configure ++++ astropy-4.2.1/cextern/wcslib/configure @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.ac Revision: 7.3 . -+# From configure.ac Revision: 7.4 . ++# From configure.ac Revision: 7.6 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for WCSLIB 7.3. -+# Generated by GNU Autoconf 2.69 for WCSLIB 7.4. ++# Generated by GNU Autoconf 2.69 for WCSLIB 7.6. # # Report bugs to . # @@ -33657,116 +40152,397 @@ Index: astropy-4.2/cextern/wcslib/configure -PACKAGE_TARNAME='wcslib-7.3' -PACKAGE_VERSION='7.3' -PACKAGE_STRING='WCSLIB 7.3' -+PACKAGE_TARNAME='wcslib-7.4' -+PACKAGE_VERSION='7.4' -+PACKAGE_STRING='WCSLIB 7.4' ++PACKAGE_TARNAME='wcslib-7.6' ++PACKAGE_VERSION='7.6' ++PACKAGE_STRING='WCSLIB 7.6' PACKAGE_BUGREPORT='mark@calabretta.id.au' PACKAGE_URL='' -@@ -1290,7 +1290,7 @@ if test "$ac_init_help" = "long"; then +@@ -625,6 +625,9 @@ ac_includes_default="\ + + ac_subst_vars='LTLIBOBJS + FLAVOUR ++OBSTZ ++OBSLAT ++OBSLNG + INSTDIR + TSTDIRS + SUBDIRS +@@ -716,6 +719,7 @@ SHELL' + ac_subst_files='' + ac_user_opts=' + enable_option_checking ++enable_flex + enable_fortran + enable_shared + enable_largefile +@@ -1290,7 +1294,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 7.3 to adapt to many kinds of systems. -+\`configure' configures WCSLIB 7.4 to adapt to many kinds of systems. ++\`configure' configures WCSLIB 7.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... -@@ -1339,7 +1339,7 @@ Fine tuning of the installation director +@@ -1339,7 +1343,7 @@ Fine tuning of the installation director --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-7.3] -+ --docdir=DIR documentation root [DATAROOTDIR/doc/wcslib-7.4] ++ --docdir=DIR documentation root [DATAROOTDIR/doc/wcslib-7.6] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] -@@ -1360,7 +1360,7 @@ fi +@@ -1360,7 +1364,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of WCSLIB 7.3:";; -+ short | recursive ) echo "Configuration of WCSLIB 7.4:";; ++ short | recursive ) echo "Configuration of WCSLIB 7.6:";; esac cat <<\_ACEOF -@@ -1464,7 +1464,7 @@ fi +@@ -1368,6 +1372,7 @@ Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] ++ --disable-flex don't apply flex (use pre-generated sources) + --enable-fortran=ARG Fortran compiler to use + --disable-fortran don't build the Fortran wrappers or PGSBOX + --disable-shared don't build the WCS shared libraries +@@ -1464,7 +1469,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -WCSLIB configure 7.3 -+WCSLIB configure 7.4 ++WCSLIB configure 7.6 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. -@@ -2238,7 +2238,7 @@ cat >config.log <<_ACEOF +@@ -2238,7 +2243,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 7.3, which was -+It was created by WCSLIB $as_me 7.4, which was ++It was created by WCSLIB $as_me 7.6, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ -@@ -9061,7 +9061,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri +@@ -2707,7 +2712,20 @@ ARCH="${host_cpu}-$host_os" + + + # Look for Flex. +-# Extract the first word of "flex", so it can be a program name with args. ++# Check whether --enable-flex was given. ++if test "${enable_flex+set}" = set; then : ++ enableval=$enable_flex; ++fi ++ ++if test "x$enable_flex" = xno ; then ++ FLEX= ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Generation of flex sources disabled by request, using ++ pre-generated sources." >&5 ++$as_echo "$as_me: WARNING: Generation of flex sources disabled by request, using ++ pre-generated sources." >&2;} ++ ++else ++ # Extract the first word of "flex", so it can be a program name with args. + set dummy flex; ac_word=$2 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 + $as_echo_n "checking for $ac_word... " >&6; } +@@ -2744,25 +2762,26 @@ $as_echo "no" >&6; } + fi + + +-if test "x$FLEX" = xflex ; then +- # Version 2.5.9 or later is required. +- V=`flex --version | awk '{print $2}'` +- W=`echo $V | awk -F. '{if ((($1*100 + $2)*100 + $3) < 20509) print "no"}'` +- if test "x$W" != x ; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: Flex version $V is too old, ignored." >&5 +-$as_echo "$as_me: Flex version $V is too old, ignored." >&6;} +- FLEX= +- else +- { $as_echo "$as_me:${as_lineno-$LINENO}: Using Flex version $V." >&5 ++ if test "x$FLEX" = xflex ; then ++ # Version 2.6.0 or later is required. ++ V=`flex --version | awk '{print $2}'` ++ W=`echo $V | awk -F. '{if ((($1*100 + $2)*100 + $3) < 20600) print "no"}'` ++ if test "x$W" != x ; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Flex version $V is too old, ignored." >&5 ++$as_echo "$as_me: WARNING: Flex version $V is too old, ignored." >&2;} ++ FLEX= ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: Using Flex version $V." >&5 + $as_echo "$as_me: Using Flex version $V." >&6;} ++ fi + fi +-fi + +-if test "x$FLEX" = x ; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Flex version 2.5.9 or later does not appear to be ++ if test "x$FLEX" = x ; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Flex version 2.6.0 or later does not appear to be + available, will use pre-generated sources." >&5 +-$as_echo "$as_me: WARNING: Flex version 2.5.9 or later does not appear to be ++$as_echo "$as_me: WARNING: Flex version 2.6.0 or later does not appear to be + available, will use pre-generated sources." >&2;} ++ fi + fi + + +@@ -5771,8 +5790,8 @@ fi + if test "x$F77" = xno ; then + F77= + +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Compilation of Fortran wrappers and PGSBOX disabled" >&5 +-$as_echo "$as_me: WARNING: Compilation of Fortran wrappers and PGSBOX disabled" >&2;} ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Compilation of Fortran wrappers and PGSBOX disabled." >&5 ++$as_echo "$as_me: WARNING: Compilation of Fortran wrappers and PGSBOX disabled." >&2;} + + else + if test "x$F77" = x ; then +@@ -6937,8 +6956,8 @@ SHRLN= + + if test "x$ac_cv_c_compiler_gnu" = xyes ; then + if test "x$enable_shared" = xno ; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Generation of WCS shared libraries disabled" >&5 +-$as_echo "$as_me: WARNING: Generation of WCS shared libraries disabled" >&2;} ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Generation of WCS shared libraries disabled." >&5 ++$as_echo "$as_me: WARNING: Generation of WCS shared libraries disabled." >&2;} + + else + SHVER=`echo "$LIBVER" | sed -e 's/\..*$//'` +@@ -7453,8 +7472,8 @@ if test "${with_cfitsio+set}" = set; the + fi + + if test "x$with_cfitsio" = xno ; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: CFITSIO disabled" >&5 +-$as_echo "$as_me: WARNING: CFITSIO disabled" >&2;} ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: CFITSIO disabled." >&5 ++$as_echo "$as_me: WARNING: CFITSIO disabled." >&2;} + else + + # Check whether --with-cfitsiolib was given. +@@ -7492,8 +7511,8 @@ if test "${with_pgplot+set}" = set; then + fi + + if test "x$with_pgplot" = xno ; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: PGPLOT disabled" >&5 +-$as_echo "$as_me: WARNING: PGPLOT disabled" >&2;} ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: PGPLOT disabled." >&5 ++$as_echo "$as_me: WARNING: PGPLOT disabled." >&2;} + else + + # Check whether --with-pgplotlib was given. +@@ -8521,13 +8540,28 @@ if test "${enable_utils+set}" = set; the + fi + + if test "x$enable_utils" = xno ; then +- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Compilation of WCS utilities disabled" >&5 +-$as_echo "$as_me: WARNING: Compilation of WCS utilities disabled" >&2;} ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Compilation of WCS utilities disabled." >&5 ++$as_echo "$as_me: WARNING: Compilation of WCS utilities disabled." >&2;} + else + SUBDIRS="$SUBDIRS utils" + INSTDIR="$INSTDIR utils" + fi + ++# Default observer coordinates for sundazel. ++if test -f "$HOME/.sundazelrc"; then ++ . "$HOME/.sundazelrc" ++fi ++ ++if test "x$OBSLNG" = x; then ++ OBSLNG=0.0 ++ OBSLAT=0.0 ++ OBSTZ=0.0 ++fi ++ ++ ++ ++ ++ + + + +@@ -9061,7 +9095,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri # 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 7.3, which was -+This file was extended by WCSLIB $as_me 7.4, which was ++This file was extended by WCSLIB $as_me 7.6, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES -@@ -9123,7 +9123,7 @@ _ACEOF +@@ -9123,7 +9157,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -WCSLIB config.status 7.3 -+WCSLIB config.status 7.4 ++WCSLIB config.status 7.6 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Index: astropy-4.2/cextern/wcslib/configure.ac +Index: astropy-4.2.1/cextern/wcslib/configure.ac =================================================================== ---- astropy-4.2.orig/cextern/wcslib/configure.ac -+++ astropy-4.2/cextern/wcslib/configure.ac +--- astropy-4.2.1.orig/cextern/wcslib/configure.ac ++++ astropy-4.2.1/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 7.3 2020/06/03 03:37:03 mcalabre Exp $ -+# $Id: configure.ac,v 7.4 2021/01/31 02:24:52 mcalabre Exp $ ++# $Id: configure.ac,v 7.6 2021/04/13 12:57:02 mcalabre Exp $ #----------------------------------------------------------------------------- -AC_INIT([WCSLIB], [7.3], [mark@calabretta.id.au], [wcslib-7.3]) -+AC_INIT([WCSLIB], [7.4], [mark@calabretta.id.au], [wcslib-7.4]) ++AC_INIT([WCSLIB], [7.6], [mark@calabretta.id.au], [wcslib-7.6]) AC_PREREQ([2.53]) -AC_REVISION([$Revision: 7.3 $]) -+AC_REVISION([$Revision: 7.4 $]) ++AC_REVISION([$Revision: 7.6 $]) AC_SUBST([PACKAGE_VERSION]) AC_DEFINE_UNQUOTED([WCSLIB_VERSION], [$PACKAGE_VERSION], [Define wcslib version]) -Index: astropy-4.2/cextern/wcslib/flavours +@@ -26,22 +26,31 @@ AC_SUBST([ARCH]) + + + # Look for Flex. +-AC_CHECK_PROG([FLEX], [flex], [flex], [], [], []) +-if test "x$FLEX" = xflex ; then +- # Version 2.5.9 or later is required. +- V=`flex --version | awk '{print $2}'` +- W=`echo $V | awk -F. '{if ((($1*100 + $2)*100 + $3) < 20509) print "no"}'` +- if test "x$W" != x ; then +- AC_MSG_NOTICE([Flex version $V is too old, ignored.]) +- FLEX= +- else +- AC_MSG_NOTICE([Using Flex version $V.]) ++AC_ARG_ENABLE([flex], [AS_HELP_STRING([--disable-flex], ++ [don't apply flex (use pre-generated sources)])], []) ++if test "x$enable_flex" = xno ; then ++ FLEX= ++ AC_MSG_WARN([Generation of flex sources disabled by request, using ++ pre-generated sources.]) ++ ++else ++ AC_CHECK_PROG([FLEX], [flex], [flex], [], [], []) ++ if test "x$FLEX" = xflex ; then ++ # Version 2.6.0 or later is required. ++ V=`flex --version | awk '{print $2}'` ++ W=`echo $V | awk -F. '{if ((($1*100 + $2)*100 + $3) < 20600) print "no"}'` ++ if test "x$W" != x ; then ++ AC_MSG_WARN([Flex version $V is too old, ignored.]) ++ FLEX= ++ else ++ AC_MSG_NOTICE([Using Flex version $V.]) ++ fi + fi +-fi + +-if test "x$FLEX" = x ; then +- AC_MSG_WARN([Flex version 2.5.9 or later does not appear to be ++ if test "x$FLEX" = x ; then ++ AC_MSG_WARN([Flex version 2.6.0 or later does not appear to be + available, will use pre-generated sources.]) ++ fi + fi + + +@@ -176,7 +185,7 @@ fi + if test "x$F77" = xno ; then + F77= + +- AC_MSG_WARN([Compilation of Fortran wrappers and PGSBOX disabled]) ++ AC_MSG_WARN([Compilation of Fortran wrappers and PGSBOX disabled.]) + + else + if test "x$F77" = x ; then +@@ -280,7 +289,7 @@ SHRLN= + + if test "x$ac_cv_c_compiler_gnu" = xyes ; then + if test "x$enable_shared" = xno ; then +- AC_MSG_WARN([Generation of WCS shared libraries disabled]) ++ AC_MSG_WARN([Generation of WCS shared libraries disabled.]) + + else + SHVER=`echo "$LIBVER" | sed -e 's/\..*$//'` +@@ -353,7 +362,7 @@ LIBDIRS= + AC_ARG_WITH([cfitsio], [AS_HELP_STRING([--without-cfitsio], + [eschew CFITSIO])], []) + if test "x$with_cfitsio" = xno ; then +- AC_MSG_WARN([CFITSIO disabled]) ++ AC_MSG_WARN([CFITSIO disabled.]) + else + AC_ARG_WITH([cfitsiolib], [AS_HELP_STRING([--with-cfitsiolib=DIR], + [directory containing cfitsio library])], []) +@@ -379,7 +388,7 @@ fi + AC_ARG_WITH([pgplot], [AS_HELP_STRING([--without-pgplot], + [eschew PGPLOT])], []) + if test "x$with_pgplot" = xno ; then +- AC_MSG_WARN([PGPLOT disabled]) ++ AC_MSG_WARN([PGPLOT disabled.]) + else + AC_ARG_WITH([pgplotlib], [AS_HELP_STRING([--with-pgplotlib=DIR], + [directory containing pgplot library])], []) +@@ -538,12 +547,23 @@ fi + AC_ARG_ENABLE([utils], [AS_HELP_STRING([--disable-utils], + [don't build the WCS utilities])], []) + if test "x$enable_utils" = xno ; then +- AC_MSG_WARN([Compilation of WCS utilities disabled]) ++ AC_MSG_WARN([Compilation of WCS utilities disabled.]) + else + SUBDIRS="$SUBDIRS utils" + INSTDIR="$INSTDIR utils" + fi + ++# Default observer coordinates for sundazel. ++if test -f "$HOME/.sundazelrc"; then ++ . "$HOME/.sundazelrc" ++fi ++ ++if test "x$OBSLNG" = x; then ++ OBSLNG=0.0 ++ OBSLAT=0.0 ++ OBSTZ=0.0 ++fi ++ + + AC_SUBST([CFITSIOINC]) + AC_SUBST([CFITSIOLIB]) +@@ -556,6 +576,10 @@ AC_SUBST([SUBDIRS]) + AC_SUBST([TSTDIRS]) + AC_SUBST([INSTDIR]) + ++AC_SUBST([OBSLNG]) ++AC_SUBST([OBSLAT]) ++AC_SUBST([OBSTZ]) ++ + AC_MSG_NOTICE([End of auxiliary configuration. + ]) + +Index: astropy-4.2.1/cextern/wcslib/flavours =================================================================== ---- astropy-4.2.orig/cextern/wcslib/flavours -+++ astropy-4.2/cextern/wcslib/flavours +--- astropy-4.2.1.orig/cextern/wcslib/flavours ++++ astropy-4.2.1/cextern/wcslib/flavours @@ -12,7 +12,7 @@ # # Reminder: add '-d' to FLFLAGS for debugging. # -# $Id: flavours,v 7.3 2020/06/03 03:37:03 mcalabre Exp $ -+# $Id: flavours,v 7.4 2021/01/31 02:24:52 mcalabre Exp $ ++# $Id: flavours,v 7.6 2021/04/13 12:57:02 mcalabre Exp $ #----------------------------------------------------------------------------- # The list of FLAVOURs can be set on the command line. -Index: astropy-4.2/cextern/wcslib/makedefs.in +Index: astropy-4.2.1/cextern/wcslib/makedefs.in =================================================================== ---- astropy-4.2.orig/cextern/wcslib/makedefs.in -+++ astropy-4.2/cextern/wcslib/makedefs.in +--- astropy-4.2.1.orig/cextern/wcslib/makedefs.in ++++ astropy-4.2.1/cextern/wcslib/makedefs.in @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# GNU makefile definitions for building WCSLIB 7.3 -+# GNU makefile definitions for building WCSLIB 7.4 ++# GNU makefile definitions for building WCSLIB 7.6 # # makedefs is generated from makedefs.in by configure. It contains variable # definitions and some general-purpose rules for building WCSLIB. @@ -33775,12 +40551,12 @@ Index: astropy-4.2/cextern/wcslib/makedefs.in # # The shared library will be installed with version number, e.g. as -# libwcs.so.7.3 or libwcs.7.3.dylib with or without the symlink -+# libwcs.so.7.4 or libwcs.7.4.dylib with or without the symlink ++# libwcs.so.7.6 or libwcs.7.6.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.7.3. -+# still link dynamically by using -lwcs.7.4. ++# still link dynamically by using -lwcs.7.6. # # 4) PGPLOT is Tim Pearson's Fortran graphics library with separate C # interface available from astro.caltech.edu. It is only required by @@ -33789,90 +40565,115 @@ Index: astropy-4.2/cextern/wcslib/makedefs.in # Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. # http://www.atnf.csiro.au/people/Mark.Calabretta -# $Id: makedefs.in,v 7.3 2020/06/03 03:37:03 mcalabre Exp $ -+# $Id: makedefs.in,v 7.4 2021/01/31 02:24:52 mcalabre Exp $ ++# $Id: makedefs.in,v 7.6 2021/04/13 12:57:02 mcalabre Exp $ #----------------------------------------------------------------------------- # Version. LIBVER := @LIBVER@ -Index: astropy-4.2/cextern/wcslib/wcsconfig.h.in +@@ -168,6 +168,12 @@ + # Libraries required by WCSLIB itself. + LIBS := @LIBS@ + ++# Default observer coordinates for sundazel. May be set as environment ++# variables, either generally or in $HOME/.sundazelrc, which is read by ++# configure. ++ OBSLNG := @OBSLNG@ ++ OBSLAT := @OBSLAT@ ++ OBSTZ := @OBSTZ@ + + #----------------------------------------------------------------------------- + # You shouldn't need to change anything below here. +@@ -245,6 +251,11 @@ show :: wcsconfig.h + -@ echo ' FLIBS := $(FLIBS)' + -@ echo ' LIBS := $(LIBS)' + -@ echo '' ++ -@ echo 'Default observer coordinates for sundazel...' ++ -@ echo ' OBSLNG := $(OBSLNG)' ++ -@ echo ' OBSLAT := $(OBSLAT)' ++ -@ echo ' OBSTZ := $(OBSTZ)' ++ -@ echo '' + + # Code development overrides, for use in the code subdirectories. + FLAVOUR := @FLAVOUR@ +Index: astropy-4.2.1/cextern/wcslib/wcsconfig.h.in =================================================================== ---- astropy-4.2.orig/cextern/wcslib/wcsconfig.h.in -+++ astropy-4.2/cextern/wcslib/wcsconfig.h.in +--- astropy-4.2.1.orig/cextern/wcslib/wcsconfig.h.in ++++ astropy-4.2.1/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 7.3 -+* C preprocessor macro definitions for compiling WCSLIB 7.4 ++* C preprocessor macro definitions for compiling WCSLIB 7.6 * * Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. * http://www.atnf.csiro.au/people/Mark.Calabretta -* $Id: wcsconfig.h.in,v 7.3 2020/06/03 03:37:03 mcalabre Exp $ -+* $Id: wcsconfig.h.in,v 7.4 2021/01/31 02:24:52 mcalabre Exp $ ++* $Id: wcsconfig.h.in,v 7.6 2021/04/13 12:57:02 mcalabre Exp $ *===========================================================================*/ /* wcslib_version() is available (as of 5.0). */ -Index: astropy-4.2/cextern/wcslib/wcsconfig_f77.h.in +Index: astropy-4.2.1/cextern/wcslib/wcsconfig_f77.h.in =================================================================== ---- astropy-4.2.orig/cextern/wcslib/wcsconfig_f77.h.in -+++ astropy-4.2/cextern/wcslib/wcsconfig_f77.h.in +--- astropy-4.2.1.orig/cextern/wcslib/wcsconfig_f77.h.in ++++ astropy-4.2.1/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 7.3 Fortran -+* contains C preprocessor definitions for building the WCSLIB 7.4 Fortran ++* contains C preprocessor definitions for building the WCSLIB 7.6 Fortran * wrappers. * * Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. * http://www.atnf.csiro.au/people/Mark.Calabretta -* $Id: wcsconfig_f77.h.in,v 7.3 2020/06/03 03:37:03 mcalabre Exp $ -+* $Id: wcsconfig_f77.h.in,v 7.4 2021/01/31 02:24:52 mcalabre Exp $ ++* $Id: wcsconfig_f77.h.in,v 7.6 2021/04/13 12:57:02 mcalabre Exp $ *===========================================================================*/ /* Integer array type large enough to hold an address. Set here to int[2] for -Index: astropy-4.2/cextern/wcslib/wcsconfig_tests.h.in +Index: astropy-4.2.1/cextern/wcslib/wcsconfig_tests.h.in =================================================================== ---- astropy-4.2.orig/cextern/wcslib/wcsconfig_tests.h.in -+++ astropy-4.2/cextern/wcslib/wcsconfig_tests.h.in +--- astropy-4.2.1.orig/cextern/wcslib/wcsconfig_tests.h.in ++++ astropy-4.2.1/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 7.3 test/demo -+* contains C preprocessor definitions for compiling the WCSLIB 7.4 test/demo ++* contains C preprocessor definitions for compiling the WCSLIB 7.6 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 7.3 2020/06/03 03:37:03 mcalabre Exp $ -+* $Id: wcsconfig_tests.h.in,v 7.4 2021/01/31 02:24:52 mcalabre Exp $ ++* $Id: wcsconfig_tests.h.in,v 7.6 2021/04/13 12:57:02 mcalabre Exp $ *===========================================================================*/ #include -Index: astropy-4.2/cextern/wcslib/wcsconfig_utils.h.in +Index: astropy-4.2.1/cextern/wcslib/wcsconfig_utils.h.in =================================================================== ---- astropy-4.2.orig/cextern/wcslib/wcsconfig_utils.h.in -+++ astropy-4.2/cextern/wcslib/wcsconfig_utils.h.in +--- astropy-4.2.1.orig/cextern/wcslib/wcsconfig_utils.h.in ++++ astropy-4.2.1/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 7.3 -+* It contains C preprocessor macro definitions for compiling the WCSLIB 7.4 ++* It contains C preprocessor macro definitions for compiling the WCSLIB 7.6 * utilities. * * Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. * http://www.atnf.csiro.au/people/Mark.Calabretta -* $Id: wcsconfig_utils.h.in,v 7.3 2020/06/03 03:37:03 mcalabre Exp $ -+* $Id: wcsconfig_utils.h.in,v 7.4 2021/01/31 02:24:52 mcalabre Exp $ ++* $Id: wcsconfig_utils.h.in,v 7.6 2021/04/13 12:57:02 mcalabre Exp $ *===========================================================================*/ #include -Index: astropy-4.2/CHANGES.rst +Index: astropy-4.2.1/CHANGES.rst =================================================================== ---- astropy-4.2.orig/CHANGES.rst -+++ astropy-4.2/CHANGES.rst -@@ -330,6 +330,10 @@ Other Changes and Additions +--- astropy-4.2.1.orig/CHANGES.rst ++++ astropy-4.2.1/CHANGES.rst +@@ -399,6 +399,10 @@ Other Changes and Additions - When importing astropy without first building the extension modules first, raise an error directly instead of trying to auto-build. [#10883] @@ -33883,10 +40684,10 @@ Index: astropy-4.2/CHANGES.rst 4.1 (2020-10-21) -Index: astropy-4.2/astropy/wcs/tests/data/validate.7.4.txt +Index: astropy-4.2.1/astropy/wcs/tests/data/validate.7.4.txt =================================================================== --- /dev/null -+++ astropy-4.2/astropy/wcs/tests/data/validate.7.4.txt ++++ astropy-4.2.1/astropy/wcs/tests/data/validate.7.4.txt @@ -0,0 +1,20 @@ +HDU 1: + WCS key ' ': @@ -33908,10 +40709,10 @@ Index: astropy-4.2/astropy/wcs/tests/data/validate.7.4.txt + 'HZ' -> 'Hz'. + - 'celfix' made the change 'In CUNIT3 : Mismatched units type + 'length': have 'Hz', want 'm''. -Index: astropy-4.2/astropy/wcs/tests/test_wcs.py +Index: astropy-4.2.1/astropy/wcs/tests/test_wcs.py =================================================================== ---- astropy-4.2.orig/astropy/wcs/tests/test_wcs.py -+++ astropy-4.2/astropy/wcs/tests/test_wcs.py +--- astropy-4.2.1.orig/astropy/wcs/tests/test_wcs.py ++++ astropy-4.2.1/astropy/wcs/tests/test_wcs.py @@ -22,6 +22,7 @@ from astropy.utils.exceptions import ( from astropy.tests.helper import assert_quantity_allclose from astropy.io import fits @@ -33920,12 +40721,30 @@ Index: astropy-4.2/astropy/wcs/tests/test_wcs.py _WCSLIB_VER = Version(_wcs.__version__) -@@ -117,11 +118,15 @@ def test_fixes(): +@@ -104,7 +105,16 @@ class TestSpectra: + header = get_pkg_data_contents( + os.path.join("data", "spectra", filename), encoding='binary') + # finally run the test. +- all_wcs = wcs.find_all_wcs(header) ++ with pytest.warns(None) as w: ++ all_wcs = wcs.find_all_wcs(header) ++ ++ if _WCSLIB_VER >= Version('7.4'): ++ assert len(w) == 9 ++ m = str(w.pop().message) ++ assert "'datfix' made the change 'Set MJD-OBS to 53925.853472 from DATE-OBS'." in m ++ else: ++ assert len(w) == 0 ++ + assert len(all_wcs) == 9 + + +@@ -117,11 +127,15 @@ def test_fixes(): with pytest.raises(wcs.InvalidTransformError), pytest.warns(wcs.FITSFixedWarning) as w: wcs.WCS(header, translate_units='dhs') - assert len(w) == 2 -+ if _WCSLIB_VER >= Version('7.4'): ++ if Version('7.4') <=_WCSLIB_VER < Version('7.6'): + assert len(w) == 3 + assert "'datfix' made the change 'Success'." in str(w.pop().message) + else: @@ -33938,7 +40757,7 @@ Index: astropy-4.2/astropy/wcs/tests/test_wcs.py # Ignore "PV2_2 = 0.209028857410973 invalid keyvalue" warning seen on Windows. -@@ -145,6 +150,7 @@ def test_pix2world(): +@@ -145,6 +159,7 @@ def test_pix2world(): """ # TODO: write this to test the expected output behavior of pix2world, # currently this just makes sure it doesn't error out in unexpected ways @@ -33946,19 +40765,19 @@ Index: astropy-4.2/astropy/wcs/tests/test_wcs.py filename = get_pkg_data_filename('data/sip2.fits') with pytest.warns(wcs.FITSFixedWarning) as caught_warnings: # this raises a warning unimportant for this testing the pix2world -@@ -153,7 +159,10 @@ def test_pix2world(): +@@ -153,7 +168,10 @@ def test_pix2world(): ww = wcs.WCS(filename) # might as well monitor for changing behavior - assert len(caught_warnings) == 1 -+ if _WCSLIB_VER >= Version('7.4'): ++ if Version('7.4') <=_WCSLIB_VER < Version('7.6'): + assert len(caught_warnings) == 2 + else: + assert len(caught_warnings) == 1 n = 3 pixels = (np.arange(n) * np.ones((2, n))).T -@@ -162,18 +171,17 @@ def test_pix2world(): +@@ -162,18 +180,17 @@ def test_pix2world(): # Catch #2791 ww.wcs_pix2world(pixels[..., 0], pixels[..., 1], 0, ra_dec_order=True) @@ -33979,11 +40798,28 @@ Index: astropy-4.2/astropy/wcs/tests/test_wcs.py def test_load_fits_path(): -@@ -319,13 +327,19 @@ def test_invalid_shape(): +@@ -213,7 +230,15 @@ def test_dict_init(): + if _WCSLIB_VER >= Version('7.1'): + hdr['DATEREF'] = '1858-11-17' + +- w = wcs.WCS(hdr) ++ with pytest.warns(None) as wrng: ++ w = wcs.WCS(hdr) ++ ++ if _WCSLIB_VER >= Version('7.4'): ++ assert len(wrng) == 1 ++ msg = str(wrng[0].message) ++ assert "'datfix' made the change 'Set MJDREF to 0.000000 from DATEREF'." in msg ++ else: ++ assert len(wrng) == 0 + + xp, yp = w.wcs_world2pix(41., 2., 0) + +@@ -319,13 +344,19 @@ def test_invalid_shape(): def test_warning_about_defunct_keywords(): header = get_pkg_data_contents('data/defunct_keywords.hdr', encoding='binary') -+ if _WCSLIB_VER >= Version('7.4'): ++ if Version('7.4') <=_WCSLIB_VER < Version('7.6'): + n_warn = 5 + else: + n_warn = 4 @@ -34001,13 +40837,15 @@ Index: astropy-4.2/astropy/wcs/tests/test_wcs.py assert 'PCi_ja' in str(item.message) -@@ -431,14 +445,14 @@ def test_find_all_wcs_crash(): +@@ -431,14 +462,16 @@ def test_find_all_wcs_crash(): def test_validate(): results = wcs.validate(get_pkg_data_filename("data/validate.fits")) results_txt = sorted(set([x.strip() for x in repr(results).splitlines()])) - version = wcs._wcs.__version__ - if version[0] in ['6', '7']: -+ if _WCSLIB_VER >= Version('7.4'): ++ if _WCSLIB_VER >= Version('7.6'): ++ filename = 'data/validate.7.6.txt' ++ elif _WCSLIB_VER >= Version('7.4'): + filename = 'data/validate.7.4.txt' + elif _WCSLIB_VER >= Version('6.0'): filename = 'data/validate.6.txt' @@ -34023,7 +40861,7 @@ Index: astropy-4.2/astropy/wcs/tests/test_wcs.py else: filename = 'data/validate.txt' with open(get_pkg_data_filename(filename), "r") as fd: -@@ -1457,3 +1471,47 @@ def test_no_pixel_area(): +@@ -1457,3 +1490,47 @@ def test_no_pixel_area(): # Pixel scales still possible assert_quantity_allclose(w.proj_plane_pixel_scales(), 1) @@ -34071,25 +40909,33 @@ Index: astropy-4.2/astropy/wcs/tests/test_wcs.py + w2 = wcs.WCS(hdulist[0].header) + + assert w.pixel_to_world(*cen).separation(w2.pixel_to_world(*(siz / 2))) < 1.e-3 * u.mas -Index: astropy-4.2/astropy/wcs/tests/test_wcsprm.py +Index: astropy-4.2.1/astropy/wcs/tests/test_wcsprm.py =================================================================== ---- astropy-4.2.orig/astropy/wcs/tests/test_wcsprm.py -+++ astropy-4.2/astropy/wcs/tests/test_wcsprm.py -@@ -414,6 +414,9 @@ def test_fix(): +--- astropy-4.2.1.orig/astropy/wcs/tests/test_wcsprm.py ++++ astropy-4.2.1/astropy/wcs/tests/test_wcsprm.py +@@ -409,11 +409,17 @@ def test_fix(): + 'unitfix': 'No change', + 'celfix': 'No change', + 'obsfix': 'No change'} ++ + version = wcs._wcs.__version__ + if Version(version) <= Version('5'): del fix_ref['obsfix'] ++ if Version(version) >= Version('7.1'): w.dateref = '1858-11-17' -+ if Version(version) >= Version('7.4'): ++ ++ if Version('7.4') <= Version(version) < Version('7.6'): + fix_ref['datfix'] = 'Success' + assert w.fix() == fix_ref -Index: astropy-4.2/setup.cfg +Index: astropy-4.2.1/setup.cfg =================================================================== ---- astropy-4.2.orig/setup.cfg -+++ astropy-4.2/setup.cfg -@@ -134,6 +134,7 @@ filterwarnings = +--- astropy-4.2.1.orig/setup.cfg ++++ astropy-4.2.1/setup.cfg +@@ -135,6 +135,7 @@ filterwarnings = ignore:the imp module is deprecated:DeprecationWarning ignore:The toolz.compatibility module is no longer needed:DeprecationWarning ignore:parallel reading does not currently work, so falling back to serial @@ -34097,10 +40943,10 @@ Index: astropy-4.2/setup.cfg doctest_norecursedirs = */setup_package.py doctest_subpackage_requires = -Index: astropy-4.2/astropy/wcs/wcs.py +Index: astropy-4.2.1/astropy/wcs/wcs.py =================================================================== ---- astropy-4.2.orig/astropy/wcs/wcs.py -+++ astropy-4.2/astropy/wcs/wcs.py +--- astropy-4.2.1.orig/astropy/wcs/wcs.py ++++ astropy-4.2.1/astropy/wcs/wcs.py @@ -2671,6 +2671,22 @@ reduce these to 2 dimensions using the n for kw in keys_to_remove: if kw in header: @@ -34124,3 +40970,134 @@ Index: astropy-4.2/astropy/wcs/wcs.py else: header = fits.Header() +Index: astropy-4.2.1/docs/changes/wcs/11549.feature.rst +=================================================================== +--- /dev/null ++++ astropy-4.2.1/docs/changes/wcs/11549.feature.rst +@@ -0,0 +1,3 @@ ++Updated bundled version of WCSLIB to version 7.6. See ++https://www.atnf.csiro.au/people/mcalabre/WCS/CHANGES for a list of ++included changes. +Index: astropy-4.2.1/astropy/wcs/tests/data/validate.7.6.txt +=================================================================== +--- /dev/null ++++ astropy-4.2.1/astropy/wcs/tests/data/validate.7.6.txt +@@ -0,0 +1,19 @@ ++HDU 1: ++ WCS key ' ': ++ - RADECSYS= 'ICRS ' / Astrometric system ++ the RADECSYS keyword is deprecated, use RADESYSa. ++ - The WCS transformation has more axes (2) than the image it is ++ associated with (0) ++ - Removed redundant SCAMP distortion parameters because SIP ++ parameters are also present ++ - 'datfix' made the change 'Set MJD-OBS to 55007.362083 from DATE- ++ OBS'. ++ ++HDU 2: ++ WCS key ' ': ++ - The WCS transformation has more axes (3) than the image it is ++ associated with (0) ++ - 'unitfix' made the change 'Changed units: ++ 'HZ' -> 'Hz'. ++ - 'celfix' made the change 'In CUNIT3 : Mismatched units type ++ 'length': have 'Hz', want 'm''. +\ No newline at end of file +Index: astropy-4.2.1/astropy/wcs/tests/test_tab.py +=================================================================== +--- astropy-4.2.1.orig/astropy/wcs/tests/test_tab.py ++++ astropy-4.2.1/astropy/wcs/tests/test_tab.py +@@ -1,14 +1,20 @@ + # Licensed under a 3-clause BSD style license - see LICENSE.rst + +-import pytest +- + import numpy as np + ++import pytest ++from packaging.version import Version + from astropy import wcs ++from astropy.wcs import _wcs # noqa ++from astropy.io import fits ++from astropy.utils.data import get_pkg_data_filename + + from . helper import SimModelTAB + + ++_WCSLIB_VER = Version(_wcs.__version__) ++ ++ + def test_2d_spatial_tab_roundtrip(tab_wcs_2di): + nx, ny = tab_wcs_2di.pixel_shape + # generate "random" test coordinates: +@@ -37,3 +43,19 @@ def test_2d_spatial_tab_vs_model(): + rd = w.wcs_pix2world(xy, 1) + rd_model = model.fwd_eval(xy) + assert np.allclose(rd, rd_model, rtol=0, atol=1e-7) ++ ++ ++@pytest.mark.skipif( ++ _WCSLIB_VER < Version('7.6'), ++ reason="Only in WCSLIB 7.6 a 1D -TAB axis roundtrips unless first axis" ++) ++def test_mixed_celest_and_1d_tab_roundtrip(): ++ # Tests WCS roundtripping for the case when there is one -TAB axis and ++ # this axis is not the first axis. This tests a bug fixed in WCSLIB 7.6. ++ filename = get_pkg_data_filename('data/tab-time-last-axis.fits') ++ hdul = fits.open(filename) ++ w = wcs.WCS(hdul[0].header, hdul) ++ hdul.close() ++ ++ pts = np.random.random((10, 3)) * [[2047, 2047, 127]] ++ assert np.allclose(pts, w.wcs_world2pix(w.wcs_pix2world(pts, 0), 0)) +Index: astropy-4.2.1/astropy/wcs/tests/test_utils.py +=================================================================== +--- astropy-4.2.1.orig/astropy/wcs/tests/test_utils.py ++++ astropy-4.2.1/astropy/wcs/tests/test_utils.py +@@ -5,6 +5,7 @@ import pytest + from io import StringIO + from itertools import product + ++from packaging.version import Version + import numpy as np + from numpy.testing import assert_almost_equal, assert_equal, assert_allclose + +@@ -17,6 +18,7 @@ from astropy.coordinates import SkyCoord + from astropy.units import Quantity + from astropy.io import fits + ++from astropy.wcs import _wcs # noqa + from astropy.wcs.wcs import (WCS, Sip, WCSSUB_LONGITUDE, WCSSUB_LATITUDE, + FITSFixedWarning) + from astropy.wcs.wcsapi.fitswcs import SlicedFITSWCS +@@ -1267,16 +1269,25 @@ def test_issue10991(): + @pytest.mark.parametrize('x_in,y_in', [[0, 0], [np.arange(5), np.arange(5)]]) + def test_pixel_to_world_itrs(x_in, y_in): + """Regression test for https://github.com/astropy/astropy/pull/9609""" +- wcs = WCS({'NAXIS': 2, +- 'CTYPE1': 'TLON-CAR', +- 'CTYPE2': 'TLAT-CAR', +- 'RADESYS': 'ITRS ', +- 'DATE-OBS': '2017-08-17T12:41:04.444'}) ++ with pytest.warns(None) as w: ++ wcs = WCS({'NAXIS': 2, ++ 'CTYPE1': 'TLON-CAR', ++ 'CTYPE2': 'TLAT-CAR', ++ 'RADESYS': 'ITRS ', ++ 'DATE-OBS': '2017-08-17T12:41:04.444'}) ++ ++ if Version(_wcs.__version__) >= Version('7.4'): ++ assert len(w) == 1 ++ msg = str(w[0].message) ++ assert "'datfix' made the change 'Set MJD-OBS to 57982.528524 from DATE-OBS'." in msg ++ else: ++ assert len(w) == 0 + + # This shouldn't raise an exception. + coord = wcs.pixel_to_world(x_in, y_in) + + # Check round trip transformation. + x, y = wcs.world_to_pixel(coord) ++ + np.testing.assert_almost_equal(x, x_in) + np.testing.assert_almost_equal(y, y_in) diff --git a/python-astropy.changes b/python-astropy.changes index 33b34be..53ac0dc 100644 --- a/python-astropy.changes +++ b/python-astropy.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Sun Jul 4 13:26:14 UTC 2021 - Ben Greiner + +- Replace astropy-pr11260-wcsfailures.patch with + astropy-pr11260+pr11549-wcs76.patch + * fixes test failures because of the recent Tumbleweed update to + wcslib 7.6 + * include binary test file tab-time-last-axis.fits from + gh#astropy/astropy#11549, which does not fit into the patchfile + ------------------------------------------------------------------- Sat Apr 17 15:30:57 UTC 2021 - Ben Greiner diff --git a/python-astropy.spec b/python-astropy.spec index 55f0d82..fd20ab2 100644 --- a/python-astropy.spec +++ b/python-astropy.spec @@ -1,5 +1,5 @@ # -# spec file for package python-astropy-test +# spec file # # Copyright (c) 2021 SUSE LLC # @@ -52,11 +52,13 @@ URL: https://astropy.org Source: https://files.pythonhosted.org/packages/source/a/astropy/astropy-%{version}.tar.gz # belongs to Patch1 -- gh/astropy/astropy#11260 Source1: https://github.com/dhomeier/astropy/raw/wcs-distortion-headers/astropy/wcs/tests/data/dss.14.29.56-62.41.05.fits.gz +# belongs to Patch1 -- gh/astropy/astropy#11549 +Source2: https://github.com/mcara/astropy/raw/wcslib7p6/astropy/wcs/tests/data/tab-time-last-axis.fits # Mark wcs headers as false positives for devel-file-in-non-devel-package # These are used by the python files so they must be available. Source100: python-astropy-rpmlintrc -# PATCH-FIX-UPSTREAM astropy-pr11260-wcsfailures.patch -- gh/astropy/astropy#11260 -Patch1: astropy-pr11260-wcsfailures.patch +# PATCH-FIX-UPSTREAM astropy-pr11260+pr11549-wcs76.patch -- gh/astropy/astropy#11260 + gh/astropy/astropy#11549 +Patch1: astropy-pr11260+pr11549-wcs76.patch # https://docs.astropy.org/en/v4.1/install.html#requirements BuildRequires: %{python_module Cython >= 0.21} BuildRequires: %{python_module Jinja2} @@ -137,7 +139,7 @@ managing them. %prep %autosetup -p1 -n astropy-%{version} -cp %{SOURCE1} astropy/wcs/tests/data/ +cp %{SOURCE1} %{SOURCE2} astropy/wcs/tests/data/ %if %{with systemlibs} # Make sure bundled libs are not used diff --git a/tab-time-last-axis.fits b/tab-time-last-axis.fits new file mode 100644 index 0000000..c6648a1 --- /dev/null +++ b/tab-time-last-axis.fits @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d2913b3cc917dcec8f9566c20b06acdfa610acca2087578d2097f69f6d710561 +size 14400