aboutsummaryrefslogtreecommitdiff
path: root/sys/imio/iki/fxf/fxfpak.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/imio/iki/fxf/fxfpak.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/imio/iki/fxf/fxfpak.x')
-rw-r--r--sys/imio/iki/fxf/fxfpak.x58
1 files changed, 58 insertions, 0 deletions
diff --git a/sys/imio/iki/fxf/fxfpak.x b/sys/imio/iki/fxf/fxfpak.x
new file mode 100644
index 00000000..01db148d
--- /dev/null
+++ b/sys/imio/iki/fxf/fxfpak.x
@@ -0,0 +1,58 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <mach.h>
+include "fxf.h"
+
+
+# FXF_PAK_DATA -- Convert npix elements of type pixtype as needed for storage
+# in a FITS file. All floating point data will be converted to IEEE format.
+# The input and output buffers may be the same if desired.
+
+procedure fxf_pak_data (ibuf, obuf, npix, pixtype)
+
+char ibuf[ARB] #I input data buffer
+char obuf[ARB] #I output data buffer
+int npix #I number of pixels in buffer
+int pixtype #I input pixel datatype
+
+int nbytes, nchars
+errchk syserr
+
+include <szpixtype.inc>
+
+begin
+ ### Possibly the MII conversion routines should be used here as
+ ### they handle all these datatypes (except maybe ushort).
+
+ nchars = npix * pix_size[pixtype]
+ nbytes = nchars * SZB_CHAR
+
+ switch (pixtype) {
+ case TY_USHORT:
+ call fxf_altmu (ibuf, obuf, npix)
+ if (BYTE_SWAP2 == YES)
+ call bswap2 (obuf, 1, obuf, 1, nbytes)
+
+ case TY_SHORT:
+ if (BYTE_SWAP2 == YES)
+ call bswap2 (ibuf, 1, obuf, 1, nbytes)
+ else
+ call amovc (ibuf, obuf, nchars)
+
+ case TY_INT, TY_LONG:
+ if (BYTE_SWAP4 == YES)
+ call bswap4 (ibuf, 1, obuf, 1, nbytes)
+ else
+ call amovc (ibuf, obuf, nchars)
+
+ case TY_REAL:
+ call ieevpakr (ibuf, obuf, npix)
+
+ case TY_DOUBLE:
+ call ieevpakd (ibuf, obuf, npix)
+
+ default:
+ call syserr (SYS_FXFPKDTYP)
+ }
+end