include # MEFOPEN --- Open a FITS extension, it can be the Primary or extension # unit, file.fits[0] for the PU or file.fits[extn] for the # Extension Unit. # # filename.ext[abs#][extname,extver] # # The absolute extension number (abs#) convention is zero for # the Primary Unit. # # MEF_OPEN -- Open a FITS Unit from a file and returns its characteristics. pointer procedure mef_open (fitsfile, acmode, oldp) char fitsfile[ARB] #I Input FITS filename int acmode #I access mode pointer oldp #I Old Fits pointer or header size pointer sp, fname, ksec, section, mef int group, clsize, extver, open() char extname[LEN_CARD] begin call smark (sp) call salloc (fname, SZ_PATHNAME, TY_CHAR) call salloc (ksec, LEN_CARD, TY_CHAR) call salloc (section, LEN_CARD, TY_CHAR) call calloc (mef, LEN_MEF, TY_STRUCT) MEF_ACMODE(mef) = acmode # Get filename components call imparse (fitsfile, MEF_FNAME(mef), SZ_FNAME, Memc[ksec], LEN_CARD, Memc[section], LEN_CARD, group, clsize) if (Memc[section] != EOS) call error("mefopen: Image sections not allowed") # Parse kernel section, accept only EXTNAME and/or EXTVER # call mef_ksection (Memc[ksec], extname, extver) MEF_FD(mef) = open (MEF_FNAME(mef), acmode, BINARY_FILE) MEF_ENUMBER(mef) = group MEF_CGROUP(mef) = -1 MEF_KEEPXT(mef) = NO call sfree (sp) return(mef) end