Viewing contents of file '../idllib/iuedac/iuelib/pro/addicom.pro'
;************************************************************************
;+
;*NAME:
;
;  	ADDICOM      8/6/93
;  
;*CLASS:
;
;	File Conversion 
;  
;*CATEGORY:
;  
;*PURPOSE:
;
;       Adds information specified interactively by the user 
;       to the input FITS header.
;  
;*CALLING SEQUENCE:
;
;  	ADDICOM,HEADER,KEYW,newhd
;  
;*PARAMETERS:
;
;       HEADER  (REQ) (IO) (1) (S)
;               FITS header to be updated. Existing entries are 
;               preserved and text from FNAME is added.
;
;       KEYW    (REQ) (I) (0) (S)
;               Keyword to precede ascii extracted from fname.
;
;       NEWHD   (OPT) (O) (1) (S)
;               If specified, output header is written to NEWHD rather
;               than input header.
;                
;
;*SYSTEM VARIABLES USED:
;
;	none
;  
;*INTERACTIVE INPUT:
;  
;*SUBROUTINES CALLED:
;
;    	PARCHECK
;  
;*FILES USED:
;  
;       none
;  
;*SIDE EFFECTS:
;  
;*RESTRICTIONS:
;  
;*NOTES:
;
;*PROCEDURE:
;
;        Prompts user for input, extracts 72 bytes from each line, adds KEYW 
;        and appends to HEADER. Original END keyword is deleted from HEADER 
;        and appended after text from FNAME.
;  
;*I_HELP nn:
;  
;*EXAMPLES:
;  
;*MODIFICATION HISTORY:
;
;      	Written by R. Thompson 9/20/94
;
;-
;************************************************************************
 pro addicom,header,keyw,newhd
;
 npar = n_params(0)
 if npar eq 0 then begin
    print,' ADDICOM,HEADER,KEYW,newhd'
    retall
 endif  ; npar
 parcheck,npar,[2,3],'ADDCOM'
;
; initialize parameters
;
 a = ''
 i = 0
 hd = strarr(900)                     ; one fits record of keywords
 hform = string(bytarr(80) + 32b)
 endkw = hform 
 strput,endkw,'END',0
 imaget = ' '
;
; prompt user for input
; add KEYW keyword to each line and 'END' at end
;
 strput,hform,strupcase(keyw),0
;
; create definition file (if keyword 'file' not specified)
; 
 print,' '
 print,'Enter comments to be added to FITS header'
 print,'Hit return to end a completed line'
 print,'Hit two returns to quit.'
 print,' '
                                       ; This program is extremely forgiving
 repeat begin                          ; as far as format of input tesxt is
    tempa = hform
    read,imaget                       
    if imaget ne '' then begin       
        strput,tempa,imaget,9                       ; store in string array
        hd(i) = tempa
        i = i + 1
    endif                             ; end if imaget ne ' '
 endrep until imaget eq ''
 hd(i) = endkw
;
; merge with input header
; remove END keyword first and add at end
;
 n1 = n_elements(header)
 tot = n1 + i + 1
 newhd = strarr(tot)
 newhd(0) = header
 delpar,newhd,'END'
 newhd(n1-1) = hd(0:i)
;
; write new header over input header
;
 if (npar lt 3) then header = newhd
;
return  
end  ; addicom