/* @(#)fitshdr.c 12.2 (ES0-DMD) 01/26/98 11:22:35 */ /*=========================================================================== Copyright (C) 1995 European Southern Observatory (ESO) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Massachusetss Ave, Cambridge, MA 02139, USA. Corresponding concerning ESO-MIDAS should be addressed as follows: Internet e-mail: midas@eso.org Postal address: European Southern Observatory Data Management Division Karl-Schwarzschild-Strasse 2 D 85748 Garching bei Muenchen GERMANY ===========================================================================*/ /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .COPYRIGHT (c) 1992 European Southern Observatory .IDENT fitshdr.c .LAUGUAGE C .AUTHOR P.Grosbol ESO/IPG .KEYWORDS FITS header, structure, initiation .COMMENT Define FITS header structure .VERSION 1.0 1991-Mar-17 : Creation, PJG .VERSION 1.1 1991-Sep-23 : Update table FDEF initiation, PJG .VERSION 1.2 1992-Feb-20 : Add theap to tables, PJG ---------------------------------------------------------------------*/ #include #include #if vms #else #ifdef FASTMEM_SET #include #endif #endif #include #include #include static BFDEF bfdef; /* FITS header structure */ static ADEF adef[MXDIM]; /* definition of data matrix axes */ static PDEF pdef[MXPAR]; /* definition of groups parameters */ static TXDEF txdef; /* Table extension definitions */ static FDEF fdef[MXF]; /* definition of table fields */ /* */ int hdr_init_M(bpntr,apntr,ppntr,cf) BFDEF *bpntr; ADEF **apntr; PDEF **ppntr; int cf; /* = 0, also init bpntr->count = 1, leave bpntr->count as it is */ { int i; ADEF *ad; PDEF *pd; if (cf == 0) bpntr->count = 0; bpntr->cflag = -1; bpntr->tflag = 0; bpntr->bflag = 0; bpntr->sflag = 0; bpntr->xflag = 0; bpntr->mflag = 0; bpntr->mtype = 0; bpntr->kwflag = 0; bpntr->naxis = 0; bpntr->pcount = 0; bpntr->gcount = 1; bpntr->bscale = 1.0; bpntr->bzero = 0.0; bpntr->bunit[0] = '\0'; bpntr->extname[0] = '\0'; for (i=0; iident[i] = ' '; bpntr->ident[MXIDNT-1] = '\0'; bpntr->data = *apntr; ad = bpntr->data; for (i=0; iparm = *ppntr; pd = bpntr->parm; for (i=0; iextd = (char *) 0; } /* */ BFDEF *hdr_init() /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .PURPOSE initiate the FITS header structure .RETURN pointer to FITS header structure ---------------------------------------------------------------------*/ { int i; bfdef.count = 0; bfdef.cflag = -1; bfdef.tflag = 0; bfdef.bflag = 0; bfdef.sflag = 0; bfdef.xflag = 0; bfdef.mflag = 0; bfdef.mtype = 0; bfdef.kwflag = 0; bfdef.naxis = 0; bfdef.pcount = 0; bfdef.gcount = 1; bfdef.bscale = 1.0; bfdef.bzero = 0.0; bfdef.bunit[0] = '\0'; bfdef.extname[0] = '\0'; for (i=0; iextd != (char *) 0) return (0); mypntr = malloc((unsigned int) (sizeof(txdef))); if (mypntr == (char *) 0) return (-5); tpntr = (TXDEF *) mypntr; bpntr->extd = mypntr; mypntr = malloc((unsigned int) (MXF*sizeof(fdef))); if (mypntr == (char *) 0) return (-5); ff = (FDEF *) mypntr; tpntr->nrow = 0; tpntr->mxrow = 0; tpntr->mxcol = 0; tpntr->theap = 0; tpntr->tfields = 0; tpntr->col = ff; for (i=0; i