/* @(#)fitsrmd.c 17.1.1.1 (ES0-DMD) 01/25/02 17:39:10 */ /*=========================================================================== 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) 1996 European Southern Observatory .IDENT fitsrmd.c .LAUGUAGE C .AUTHOR P.Grosbol ESO/IPG .KEYWORDS FITS, decode MIDAS descriptor cards .COMMENT decodes a FITS HISTORY card in MIDAS format .VERSION 1.0 1990-Feb-26 : Creation, PJG .VERSION 2.0 1991-Feb-15 : Change structures, PJG .VERSION 2.1 1993-Nov-25 : Update to new SC + prototypes, PJG .VERSION 2.2 1996-Oct-22 : Update to length of descriptor name, PJG .VERSION 2.3 2002-Jan-11 : Add logical format, PJG ---------------------------------------------------------------------*/ #include #include #include static int mdcc; /* MIDAS descriptor char. count */ static int mdsc; /* MIDAS descriptor special char. */ static int mdfe; /* MIDAS descriptor first element */ static int mdle; /* MIDAS descriptor last element */ static int mdfw; /* MIDAS descriptor field width */ static int mdcw; /* MIDAS descriptor character width */ static int mdvpl; /* MIDAS descriptor values per line */ static int mdunit[4]; /* MIDAS descriptor unit */ static char mdt; /* MIDAS descriptor type */ static char mdn[MXMDN]; /* MIDAS descriptor name */ static char buf[81]; /* buffer for MIDAS C*n descriptor */ int fitsrmd(mfd,kw,pmdc) /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .PURPOSE decode FITS HISTORY card in MIDAS format .RETURN status - 0:OK, -1:error ---------------------------------------------------------------------*/ int mfd; /* IN: MIDAS file descriptor */ KWORD *kw; /* IN: keyword structure */ int *pmdc; /* IN/OUT: MIDAS desc. count */ { char c,*ps,*pc; int i,n,k,null; float f; double d; if (*pmdc) { pc = kw->pcom + 1; switch (mdt) { case 'S' : n = mdvpl * mdfw; while (n--) { c = *pc++; if (mdsc) { if (c=='n') buf[mdcc++] = '\n'; else if (c=='\\') buf[mdcc++] = '\\'; else buf[mdcc++] = ' '; mdsc = 0; } else if (c=='\\') { mdsc = 1; continue; } else buf[mdcc++] = c; if (1val.pc; i = 0; if (!fldis(&pc,&ps)) while (*ps && i