aboutsummaryrefslogtreecommitdiff
path: root/sys/osb/miipak.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/osb/miipak.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/osb/miipak.x')
-rw-r--r--sys/osb/miipak.x57
1 files changed, 57 insertions, 0 deletions
diff --git a/sys/osb/miipak.x b/sys/osb/miipak.x
new file mode 100644
index 00000000..b86bc054
--- /dev/null
+++ b/sys/osb/miipak.x
@@ -0,0 +1,57 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mii.h>
+
+.help mii
+.nf ___________________________________________________________________________
+MII -- Machine independent integer format conversion routines. The MII integer
+format provides for three machine independent integer datatypes:
+
+ MII_BYTE 8 bit unsigned byte
+ MII_SHORT 16 bit twos complement signed integer
+ MII_LONG 32 bit twos complement signed integer
+
+plus, more recently, two IEEE floating point formats:
+
+ MII_REAL 32 bit IEEE floating point
+ MII_DOUBLE 64 bit IEEE floating point
+
+The MII datatypes are the same as are used in the FITS transportable image
+format. In the case of the short and long integers, the most significant
+bytes of an integer are given first.
+
+The routines in this package are provided for converting to and from the
+MII format and the SPP format. The latter format, of course, is potentially
+quite machine dependent. The implementation given here assumes that the
+SPP datatypes include 16 bit and 32 bit twos complement integers; the ordering
+of the bytes within these integer formats is described by the machine
+constants BYTE_SWAP2 and BYTE_SWAP4. Byte swapping for the IEEE floating
+formats is defined by the machine constants IEEE_SWAP4 and IEEE_SWAP8.
+.endhelp ______________________________________________________________________
+
+
+# MIIPAK -- Pack a SPP array of type spp_type into a MII array of type
+# mii_type. The mii_types are defined in mii.h.
+
+procedure miipak (spp, mii, nelems, spp_datatype, mii_datatype)
+
+int spp[ARB] #I input array of SPP integers
+int mii[ARB] #O output MII format array
+int nelems #I number of integers to be converted
+int spp_datatype #I SPP datatype code
+int mii_datatype #I MII datatype code
+
+begin
+ switch (mii_datatype) {
+ case MII_BYTE:
+ call miipak8 (spp, mii, nelems, spp_datatype)
+ case MII_SHORT:
+ call miipak16 (spp, mii, nelems, spp_datatype)
+ case MII_LONG:
+ call miipak32 (spp, mii, nelems, spp_datatype)
+ case MII_REAL:
+ call miipakr (spp, mii, nelems, spp_datatype)
+ case MII_DOUBLE:
+ call miipakd (spp, mii, nelems, spp_datatype)
+ }
+end