aboutsummaryrefslogtreecommitdiff
path: root/sys/imio/impak.gx
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/impak.gx
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/imio/impak.gx')
-rw-r--r--sys/imio/impak.gx46
1 files changed, 46 insertions, 0 deletions
diff --git a/sys/imio/impak.gx b/sys/imio/impak.gx
new file mode 100644
index 00000000..feb37f2c
--- /dev/null
+++ b/sys/imio/impak.gx
@@ -0,0 +1,46 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# IMPAK? -- Convert an array of pixels of a specific datatype to the
+# datatype given as the final argument.
+
+procedure impak$t (a, b, npix, dtype)
+
+PIXEL a[npix]
+int b[npix], npix, dtype
+
+pointer bp
+
+begin
+ switch (dtype) {
+ case TY_USHORT:
+ call acht$tu (a, b, npix)
+ case TY_SHORT:
+ call acht$ts (a, b, npix)
+ case TY_INT:
+ if (SZ_INT == SZ_INT32)
+ call acht$ti (a, b, npix)
+ else {
+ call malloc (bp, npix, TY_INT)
+ call acht$ti (a, Memi[bp], npix)
+ call ipak32 (Memi[bp], b, npix)
+ call mfree (bp, TY_INT)
+ }
+ case TY_LONG:
+ if (SZ_INT == SZ_INT32)
+ call acht$tl (a, b, npix)
+ else {
+ call malloc (bp, npix, TY_LONG)
+ call acht$tl (a, Meml[bp], npix)
+ call ipak32 (Meml[bp], b, npix)
+ call mfree (bp, TY_LONG)
+ }
+ case TY_REAL:
+ call acht$tr (a, b, npix)
+ case TY_DOUBLE:
+ call acht$td (a, b, npix)
+ case TY_COMPLEX:
+ call acht$tx (a, b, npix)
+ default:
+ call error (1, "Unknown datatype in imagefile")
+ }
+end