diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /noao/mtlocal/r2df/r2dfrd.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'noao/mtlocal/r2df/r2dfrd.x')
-rw-r--r-- | noao/mtlocal/r2df/r2dfrd.x | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/noao/mtlocal/r2df/r2dfrd.x b/noao/mtlocal/r2df/r2dfrd.x new file mode 100644 index 00000000..80a492e9 --- /dev/null +++ b/noao/mtlocal/r2df/r2dfrd.x @@ -0,0 +1,72 @@ +include <error.h> +include <imhdr.h> +include "r2df.h" + +# R2DFRD -- Convert a 2D-FRUTTI file into an IRAF imagefile. +# An EOT is signalled by returning EOF. + +int procedure r2dfrd (camfile, iraffile) + +char camfile[ARB] +char iraffile[ARB] + +int stat +pointer cam_fd, im +int r2dfrhdr() +pointer mtopen(), immap() +errchk salloc, r2dfrhdr, mtopen, close, immap, delete +errchk r2dfrim +include "r2df.com" + +begin + # Open input 2D-FRUTTI file. If an error occurs on open file + # is at EOT. + + cam_fd = mtopen (camfile, READ_ONLY, 0) + + # Print long or short header. + + if (long_header == YES || short_header == YES) { + if (make_image == YES) { + call printf ("File: %s ") + call pargstr (iraffile) + } else { + call printf ("File: %s ") + call pargstr (camfile) + } + if (long_header == YES) + call printf ("\n") + } + + # Create IRAF image header. If only a header listing is desired + # then a temporary image header is created and later deleted. + + if (make_image == NO) + call strcpy ("dev$null", iraffile, SZ_FNAME) + im = immap (iraffile, NEW_IMAGE, LEN_USER_AREA) + + # Read the header. EOT is signalled by an EOF status from fits_read_ + # header. Create an IRAF image if desired + + iferr { + stat = r2dfrhdr (cam_fd, im) + if (stat == EOF) + call printf ("End of data\n") + else { + if (make_image == YES) + call r2dfrim (cam_fd, im) + } + } then + call erract (EA_WARN) + + # Close files and clean up. + + call imunmap (im) + if (stat == EOF || make_image == NO) + call imdelete (iraffile) + if (long_header == YES) + call printf ("\n") + call close (cam_fd) + + return (stat) +end |