include include # MEFENCODE -- Routines to encode keyword, value and comment into a FITS card define LEN_OBJECT 63 define CENTURY 1900 # MEF_ENCODEB -- Procedure to encode a boolean parameter into a FITS card. procedure mef_encodeb (keyword, param, card, comment) char keyword[ARB] #I FITS keyword int param #I integer parameter equal to YES/NO char card[ARB] #O FITS card image char comment[ARB] #I FITS comment string char truth begin if (param == YES) truth = 'T' else truth = 'F' call sprintf (card, LEN_CARD, "%-8.8s= %20c / %-47.47s") call pargstr (keyword) call pargc (truth) call pargstr (comment) end # MEF_ENCODEI -- Procedure to encode an integer parameter into a FITS card. procedure mef_encodei (keyword, param, card, comment) char keyword[ARB] #I FITS keyword int param #I integer parameter char card[ARB] #O FITS card image char comment[ARB] #I FITS comment string begin call sprintf (card, LEN_CARD, "%-8.8s= %20d / %-47.47s") call pargstr (keyword) call pargi (param) call pargstr (comment) end # MEF_ENCODEL -- Procedure to encode a long parameter into a FITS card. procedure mef_encodel (keyword, param, card, comment) char keyword[ARB] #I FITS keyword long param #I long integer parameter char card[ARB] #O FITS card image char comment[ARB] #I FITS comment string begin call sprintf (card, LEN_CARD, "%-8.8s= %20d / %-47.47s") call pargstr (keyword) call pargl (param) call pargstr (comment) end # MEF_ENCODER -- Procedure to encode a real parameter into a FITS card. procedure mef_encoder (keyword, param, card, comment, precision) char keyword[ARB] #I FITS keyword real param #I real parameter char card[ARB] #O FITS card image char comment[ARB] #I FITS comment card int precision #I precision of real begin call sprintf (card, LEN_CARD, "%-8.8s= %20.*e / %-47.47s") call pargstr (keyword) call pargi (precision) call pargr (param) call pargstr (comment) end # MEF_ENCODED -- Procedure to encode a double parameter into a FITS card. procedure mef_encoded (keyword, param, card, comment, precision) char keyword[ARB] #I FITS keyword double param #I double parameter char card[ARB] #O FITS card image char comment[ARB] #I FITS comment string int precision #I FITS precision begin call sprintf (card, LEN_CARD, "%-8.8s= %20.*e / %-47.47s") call pargstr (keyword) call pargi (precision) call pargd (param) call pargstr (comment) end # MEF_ENCODE_AXIS -- Procedure to add the axis number to axis dependent # keywords. procedure mef_encode_axis (root, keyword, axisno) char root[ARB] #I FITS root keyword char keyword[ARB] #O FITS keyword int axisno #I FITS axis number begin call strcpy (root, keyword, SZ_KEYWORD) call sprintf (keyword, SZ_KEYWORD, "%-5.5s%-3.3s") call pargstr (root) call pargi (axisno) end # MEF_ENCODEC -- Procedure to encode an IRAF string parameter into a FITS card. procedure mef_encodec (keyword, param, maxch, card, comment) char keyword[LEN_CARD] #I FITS keyword char param[LEN_CARD] #I FITS string parameter int maxch #I maximum number of characters in param char card[LEN_CARD+1] #O FITS card image char comment[LEN_CARD] #I comment string int nblanks, maxchar, slashp begin maxchar = max(8, min (maxch, LEN_OBJECT)) slashp = 32 nblanks = LEN_CARD - (slashp + 1) if (maxchar >= 19) { slashp = 1 nblanks = max (LEN_OBJECT - maxchar - slashp+3, 1) } call sprintf (card, LEN_CARD, "%-8.8s= '%*.*s' %*t/ %*.*s") call pargstr (keyword) call pargi (-maxchar) call pargi (maxchar) call pargstr (param) call pargi (slashp) call pargi (-nblanks) call pargi (nblanks) call pargstr (comment) end # MEF_ENCODE_DATE -- Procedure to encode the date in the form dd/mm/yy. procedure mef_encode_date (datestr, szdate) char datestr[ARB] # string containing the date int szdate # number of chars in the date string long ctime int time[LEN_TMSTRUCT] long clktime() begin ctime = clktime (long (0)) call brktime (ctime, time) call sprintf (datestr, szdate, "%02s/%02s/%02s") call pargi (TM_MDAY(time)) call pargi (TM_MONTH(time)) call pargi (mod (TM_YEAR(time), CENTURY)) end # MEF_AKWC -- Encode keyword, value and comment into a FITS card and # append it to a buffer pointed by pn. procedure mef_akwc (keyword, value, len, comment, pn) char keyword[SZ_KEYWORD] # keyword name char value[ARB] # Keyword value int len # Lenght of value char comment[ARB] # Comment pointer pn # Pointer to a char area char card[LEN_CARD] begin call mef_encodec (keyword, value, len, card, comment) call amovc (card, Memc[pn], LEN_CARD) pn = pn + LEN_CARD end # MEF_AKWB -- Encode keyword, value and comment into a FITS card and # append it to a buffer pointed by pn. procedure mef_akwb (keyword, value, comment, pn) char keyword[SZ_KEYWORD] # I keyword name int value # I Keyword value (YES, NO) char comment[ARB] # I Comment pointer pn # I/O Pointer to a char area pointer sp, pc begin call smark(sp) call salloc (pc, LEN_CARD, TY_CHAR) call mef_encodeb (keyword, value, Memc[pc], comment) call amovc (Memc[pc], Memc[pn], LEN_CARD) pn = pn + LEN_CARD call sfree(sp) end # MEF_AKWI -- Encode keyword, value and comment into a FITS card and # append it to a buffer pointed by pn. procedure mef_akwi (keyword, value, comment, pn) char keyword[SZ_KEYWORD] # I keyword name int value # I Keyword value char comment[ARB] # I Comment pointer pn # I/O Pointer to a char area pointer sp, pc begin call smark(sp) call salloc (pc, LEN_CARD, TY_CHAR) call mef_encodei (keyword, value, Memc[pc], comment) call amovc (Memc[pc], Memc[pn], LEN_CARD) pn = pn + LEN_CARD call sfree(sp) end # MEF_AKWR -- Encode keyword, value and comment into a FITS card and # append it to a buffer pointed by pn. procedure mef_akwr (keyword, value, comment, precision, pn) char keyword[SZ_KEYWORD] # I keyword name real value # I Keyword value char comment[ARB] # I Comment int precision pointer pn # I/O Pointer to a char area pointer sp, pc begin call smark(sp) call salloc (pc, LEN_CARD, TY_CHAR) call mef_encoder (keyword, value, Memc[pc], comment, precision) call amovc (Memc[pc], Memc[pn], LEN_CARD) pn = pn + LEN_CARD call sfree(sp) end # MEF_AKWD -- Encode keyword, value and comment into a FITS card and # append it to a buffer pointed by pn. procedure mef_akwd (keyword, value, comment, precision, pn) char keyword[SZ_KEYWORD] # I keyword name double value # I Keyword value char comment[ARB] # I Comment int precision pointer pn # I/O Pointer to a char area pointer sp, pc begin call smark(sp) call salloc (pc, LEN_CARD, TY_CHAR) call mef_encoded (keyword, value, Memc[pc], comment, precision) call amovc (Memc[pc], Memc[pn], LEN_CARD) pn = pn + LEN_CARD call sfree(sp) end