aboutsummaryrefslogtreecommitdiff
path: root/sys/imio/tf
diff options
context:
space:
mode:
Diffstat (limited to 'sys/imio/tf')
-rw-r--r--sys/imio/tf/imflsd.x34
-rw-r--r--sys/imio/tf/imflsi.x34
-rw-r--r--sys/imio/tf/imflsl.x34
-rw-r--r--sys/imio/tf/imflsr.x34
-rw-r--r--sys/imio/tf/imflss.x34
-rw-r--r--sys/imio/tf/imflsx.x34
-rw-r--r--sys/imio/tf/imggsd.x21
-rw-r--r--sys/imio/tf/imggsi.x21
-rw-r--r--sys/imio/tf/imggsl.x21
-rw-r--r--sys/imio/tf/imggsr.x21
-rw-r--r--sys/imio/tf/imggss.x21
-rw-r--r--sys/imio/tf/imggsx.x21
-rw-r--r--sys/imio/tf/imgl1d.x35
-rw-r--r--sys/imio/tf/imgl1i.x35
-rw-r--r--sys/imio/tf/imgl1l.x35
-rw-r--r--sys/imio/tf/imgl1r.x35
-rw-r--r--sys/imio/tf/imgl1s.x35
-rw-r--r--sys/imio/tf/imgl1x.x35
-rw-r--r--sys/imio/tf/imgl2d.x47
-rw-r--r--sys/imio/tf/imgl2i.x47
-rw-r--r--sys/imio/tf/imgl2l.x47
-rw-r--r--sys/imio/tf/imgl2r.x47
-rw-r--r--sys/imio/tf/imgl2s.x47
-rw-r--r--sys/imio/tf/imgl2x.x47
-rw-r--r--sys/imio/tf/imgl3d.x51
-rw-r--r--sys/imio/tf/imgl3i.x51
-rw-r--r--sys/imio/tf/imgl3l.x51
-rw-r--r--sys/imio/tf/imgl3r.x51
-rw-r--r--sys/imio/tf/imgl3s.x51
-rw-r--r--sys/imio/tf/imgl3x.x51
-rw-r--r--sys/imio/tf/imgnld.x29
-rw-r--r--sys/imio/tf/imgnli.x29
-rw-r--r--sys/imio/tf/imgnll.x29
-rw-r--r--sys/imio/tf/imgnlr.x29
-rw-r--r--sys/imio/tf/imgnls.x29
-rw-r--r--sys/imio/tf/imgnlx.x29
-rw-r--r--sys/imio/tf/imgs1d.x18
-rw-r--r--sys/imio/tf/imgs1i.x18
-rw-r--r--sys/imio/tf/imgs1l.x18
-rw-r--r--sys/imio/tf/imgs1r.x18
-rw-r--r--sys/imio/tf/imgs1s.x18
-rw-r--r--sys/imio/tf/imgs1x.x18
-rw-r--r--sys/imio/tf/imgs2d.x26
-rw-r--r--sys/imio/tf/imgs2i.x26
-rw-r--r--sys/imio/tf/imgs2l.x26
-rw-r--r--sys/imio/tf/imgs2r.x26
-rw-r--r--sys/imio/tf/imgs2s.x26
-rw-r--r--sys/imio/tf/imgs2x.x26
-rw-r--r--sys/imio/tf/imgs3d.x29
-rw-r--r--sys/imio/tf/imgs3i.x29
-rw-r--r--sys/imio/tf/imgs3l.x29
-rw-r--r--sys/imio/tf/imgs3r.x29
-rw-r--r--sys/imio/tf/imgs3s.x29
-rw-r--r--sys/imio/tf/imgs3x.x29
-rw-r--r--sys/imio/tf/impakd.x46
-rw-r--r--sys/imio/tf/impaki.x46
-rw-r--r--sys/imio/tf/impakl.x46
-rw-r--r--sys/imio/tf/impakr.x46
-rw-r--r--sys/imio/tf/impaks.x46
-rw-r--r--sys/imio/tf/impakx.x46
-rw-r--r--sys/imio/tf/impgsd.x33
-rw-r--r--sys/imio/tf/impgsi.x33
-rw-r--r--sys/imio/tf/impgsl.x33
-rw-r--r--sys/imio/tf/impgsr.x33
-rw-r--r--sys/imio/tf/impgss.x33
-rw-r--r--sys/imio/tf/impgsx.x33
-rw-r--r--sys/imio/tf/impl1d.x34
-rw-r--r--sys/imio/tf/impl1i.x34
-rw-r--r--sys/imio/tf/impl1l.x34
-rw-r--r--sys/imio/tf/impl1r.x34
-rw-r--r--sys/imio/tf/impl1s.x34
-rw-r--r--sys/imio/tf/impl1x.x34
-rw-r--r--sys/imio/tf/impl2d.x47
-rw-r--r--sys/imio/tf/impl2i.x47
-rw-r--r--sys/imio/tf/impl2l.x47
-rw-r--r--sys/imio/tf/impl2r.x47
-rw-r--r--sys/imio/tf/impl2s.x47
-rw-r--r--sys/imio/tf/impl2x.x47
-rw-r--r--sys/imio/tf/impl3d.x51
-rw-r--r--sys/imio/tf/impl3i.x51
-rw-r--r--sys/imio/tf/impl3l.x51
-rw-r--r--sys/imio/tf/impl3r.x51
-rw-r--r--sys/imio/tf/impl3s.x51
-rw-r--r--sys/imio/tf/impl3x.x51
-rw-r--r--sys/imio/tf/impnld.x31
-rw-r--r--sys/imio/tf/impnli.x31
-rw-r--r--sys/imio/tf/impnll.x31
-rw-r--r--sys/imio/tf/impnlr.x31
-rw-r--r--sys/imio/tf/impnls.x31
-rw-r--r--sys/imio/tf/impnlx.x31
-rw-r--r--sys/imio/tf/imps1d.x20
-rw-r--r--sys/imio/tf/imps1i.x20
-rw-r--r--sys/imio/tf/imps1l.x20
-rw-r--r--sys/imio/tf/imps1r.x20
-rw-r--r--sys/imio/tf/imps1s.x20
-rw-r--r--sys/imio/tf/imps1x.x20
-rw-r--r--sys/imio/tf/imps2d.x26
-rw-r--r--sys/imio/tf/imps2i.x26
-rw-r--r--sys/imio/tf/imps2l.x26
-rw-r--r--sys/imio/tf/imps2r.x26
-rw-r--r--sys/imio/tf/imps2s.x26
-rw-r--r--sys/imio/tf/imps2x.x26
-rw-r--r--sys/imio/tf/imps3d.x29
-rw-r--r--sys/imio/tf/imps3i.x29
-rw-r--r--sys/imio/tf/imps3l.x29
-rw-r--r--sys/imio/tf/imps3r.x29
-rw-r--r--sys/imio/tf/imps3s.x29
-rw-r--r--sys/imio/tf/imps3x.x29
-rw-r--r--sys/imio/tf/imupkd.x34
-rw-r--r--sys/imio/tf/imupki.x34
-rw-r--r--sys/imio/tf/imupkl.x34
-rw-r--r--sys/imio/tf/imupkr.x34
-rw-r--r--sys/imio/tf/imupks.x34
-rw-r--r--sys/imio/tf/imupkx.x34
-rw-r--r--sys/imio/tf/mkpkg123
115 files changed, 3969 insertions, 0 deletions
diff --git a/sys/imio/tf/imflsd.x b/sys/imio/tf/imflsd.x
new file mode 100644
index 00000000..bc12f5b5
--- /dev/null
+++ b/sys/imio/tf/imflsd.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMFLS? -- Flush the output buffer, if necessary. Convert the datatype
+# of the pixels upon output, if the datatype of the pixels in the imagefile
+# is different than that requested by the calling program.
+
+procedure imflsd (imdes)
+
+pointer imdes
+pointer bdes, bp
+errchk imflsh
+
+begin
+ # Ignore the flush request if the output buffer has already been
+ # flushed.
+
+ if (IM_FLUSH(imdes) == YES) {
+ bdes = IM_OBDES(imdes)
+ bp = BD_BUFPTR(bdes)
+
+ # Convert datatype of pixels, if necessary, and flush buffer.
+ if (IM_PIXTYPE(imdes) != TY_DOUBLE || SZ_INT != SZ_INT32) {
+ call impakd (Memc[bp], Memc[bp], BD_NPIX(bdes),
+ IM_PIXTYPE(imdes))
+ }
+
+ call imflsh (imdes, bp, BD_VS(bdes,1), BD_VE(bdes,1), BD_NDIM(bdes))
+
+ IM_FLUSH(imdes) = NO
+ }
+end
diff --git a/sys/imio/tf/imflsi.x b/sys/imio/tf/imflsi.x
new file mode 100644
index 00000000..b7a4b4fb
--- /dev/null
+++ b/sys/imio/tf/imflsi.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMFLS? -- Flush the output buffer, if necessary. Convert the datatype
+# of the pixels upon output, if the datatype of the pixels in the imagefile
+# is different than that requested by the calling program.
+
+procedure imflsi (imdes)
+
+pointer imdes
+pointer bdes, bp
+errchk imflsh
+
+begin
+ # Ignore the flush request if the output buffer has already been
+ # flushed.
+
+ if (IM_FLUSH(imdes) == YES) {
+ bdes = IM_OBDES(imdes)
+ bp = BD_BUFPTR(bdes)
+
+ # Convert datatype of pixels, if necessary, and flush buffer.
+ if (IM_PIXTYPE(imdes) != TY_INT || SZ_INT != SZ_INT32) {
+ call impaki (Memc[bp], Memc[bp], BD_NPIX(bdes),
+ IM_PIXTYPE(imdes))
+ }
+
+ call imflsh (imdes, bp, BD_VS(bdes,1), BD_VE(bdes,1), BD_NDIM(bdes))
+
+ IM_FLUSH(imdes) = NO
+ }
+end
diff --git a/sys/imio/tf/imflsl.x b/sys/imio/tf/imflsl.x
new file mode 100644
index 00000000..26934cb1
--- /dev/null
+++ b/sys/imio/tf/imflsl.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMFLS? -- Flush the output buffer, if necessary. Convert the datatype
+# of the pixels upon output, if the datatype of the pixels in the imagefile
+# is different than that requested by the calling program.
+
+procedure imflsl (imdes)
+
+pointer imdes
+pointer bdes, bp
+errchk imflsh
+
+begin
+ # Ignore the flush request if the output buffer has already been
+ # flushed.
+
+ if (IM_FLUSH(imdes) == YES) {
+ bdes = IM_OBDES(imdes)
+ bp = BD_BUFPTR(bdes)
+
+ # Convert datatype of pixels, if necessary, and flush buffer.
+ if (IM_PIXTYPE(imdes) != TY_LONG || SZ_INT != SZ_INT32) {
+ call impakl (Memc[bp], Memc[bp], BD_NPIX(bdes),
+ IM_PIXTYPE(imdes))
+ }
+
+ call imflsh (imdes, bp, BD_VS(bdes,1), BD_VE(bdes,1), BD_NDIM(bdes))
+
+ IM_FLUSH(imdes) = NO
+ }
+end
diff --git a/sys/imio/tf/imflsr.x b/sys/imio/tf/imflsr.x
new file mode 100644
index 00000000..b19f1bcc
--- /dev/null
+++ b/sys/imio/tf/imflsr.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMFLS? -- Flush the output buffer, if necessary. Convert the datatype
+# of the pixels upon output, if the datatype of the pixels in the imagefile
+# is different than that requested by the calling program.
+
+procedure imflsr (imdes)
+
+pointer imdes
+pointer bdes, bp
+errchk imflsh
+
+begin
+ # Ignore the flush request if the output buffer has already been
+ # flushed.
+
+ if (IM_FLUSH(imdes) == YES) {
+ bdes = IM_OBDES(imdes)
+ bp = BD_BUFPTR(bdes)
+
+ # Convert datatype of pixels, if necessary, and flush buffer.
+ if (IM_PIXTYPE(imdes) != TY_REAL || SZ_INT != SZ_INT32) {
+ call impakr (Memc[bp], Memc[bp], BD_NPIX(bdes),
+ IM_PIXTYPE(imdes))
+ }
+
+ call imflsh (imdes, bp, BD_VS(bdes,1), BD_VE(bdes,1), BD_NDIM(bdes))
+
+ IM_FLUSH(imdes) = NO
+ }
+end
diff --git a/sys/imio/tf/imflss.x b/sys/imio/tf/imflss.x
new file mode 100644
index 00000000..1034413b
--- /dev/null
+++ b/sys/imio/tf/imflss.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMFLS? -- Flush the output buffer, if necessary. Convert the datatype
+# of the pixels upon output, if the datatype of the pixels in the imagefile
+# is different than that requested by the calling program.
+
+procedure imflss (imdes)
+
+pointer imdes
+pointer bdes, bp
+errchk imflsh
+
+begin
+ # Ignore the flush request if the output buffer has already been
+ # flushed.
+
+ if (IM_FLUSH(imdes) == YES) {
+ bdes = IM_OBDES(imdes)
+ bp = BD_BUFPTR(bdes)
+
+ # Convert datatype of pixels, if necessary, and flush buffer.
+ if (IM_PIXTYPE(imdes) != TY_SHORT || SZ_INT != SZ_INT32) {
+ call impaks (Memc[bp], Memc[bp], BD_NPIX(bdes),
+ IM_PIXTYPE(imdes))
+ }
+
+ call imflsh (imdes, bp, BD_VS(bdes,1), BD_VE(bdes,1), BD_NDIM(bdes))
+
+ IM_FLUSH(imdes) = NO
+ }
+end
diff --git a/sys/imio/tf/imflsx.x b/sys/imio/tf/imflsx.x
new file mode 100644
index 00000000..7e847ffe
--- /dev/null
+++ b/sys/imio/tf/imflsx.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMFLS? -- Flush the output buffer, if necessary. Convert the datatype
+# of the pixels upon output, if the datatype of the pixels in the imagefile
+# is different than that requested by the calling program.
+
+procedure imflsx (imdes)
+
+pointer imdes
+pointer bdes, bp
+errchk imflsh
+
+begin
+ # Ignore the flush request if the output buffer has already been
+ # flushed.
+
+ if (IM_FLUSH(imdes) == YES) {
+ bdes = IM_OBDES(imdes)
+ bp = BD_BUFPTR(bdes)
+
+ # Convert datatype of pixels, if necessary, and flush buffer.
+ if (IM_PIXTYPE(imdes) != TY_COMPLEX || SZ_INT != SZ_INT32) {
+ call impakx (Memc[bp], Memc[bp], BD_NPIX(bdes),
+ IM_PIXTYPE(imdes))
+ }
+
+ call imflsh (imdes, bp, BD_VS(bdes,1), BD_VE(bdes,1), BD_NDIM(bdes))
+
+ IM_FLUSH(imdes) = NO
+ }
+end
diff --git a/sys/imio/tf/imggsd.x b/sys/imio/tf/imggsd.x
new file mode 100644
index 00000000..509da31b
--- /dev/null
+++ b/sys/imio/tf/imggsd.x
@@ -0,0 +1,21 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGGS? -- Get a general section.
+
+pointer procedure imggsd (imdes, vs, ve, ndim)
+
+pointer imdes
+long vs[IM_MAXDIM], ve[IM_MAXDIM]
+int ndim
+long totpix
+pointer bp, imggsc()
+errchk imggsc
+
+begin
+ bp = imggsc (imdes, vs, ve, ndim, TY_DOUBLE, totpix)
+ if (IM_PIXTYPE(imdes) != TY_DOUBLE)
+ call imupkd (Memd[bp], Memd[bp], totpix, IM_PIXTYPE(imdes))
+ return (bp)
+end
diff --git a/sys/imio/tf/imggsi.x b/sys/imio/tf/imggsi.x
new file mode 100644
index 00000000..9cd0e00c
--- /dev/null
+++ b/sys/imio/tf/imggsi.x
@@ -0,0 +1,21 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGGS? -- Get a general section.
+
+pointer procedure imggsi (imdes, vs, ve, ndim)
+
+pointer imdes
+long vs[IM_MAXDIM], ve[IM_MAXDIM]
+int ndim
+long totpix
+pointer bp, imggsc()
+errchk imggsc
+
+begin
+ bp = imggsc (imdes, vs, ve, ndim, TY_INT, totpix)
+ if (IM_PIXTYPE(imdes) != TY_INT)
+ call imupki (Memi[bp], Memi[bp], totpix, IM_PIXTYPE(imdes))
+ return (bp)
+end
diff --git a/sys/imio/tf/imggsl.x b/sys/imio/tf/imggsl.x
new file mode 100644
index 00000000..e4d2411d
--- /dev/null
+++ b/sys/imio/tf/imggsl.x
@@ -0,0 +1,21 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGGS? -- Get a general section.
+
+pointer procedure imggsl (imdes, vs, ve, ndim)
+
+pointer imdes
+long vs[IM_MAXDIM], ve[IM_MAXDIM]
+int ndim
+long totpix
+pointer bp, imggsc()
+errchk imggsc
+
+begin
+ bp = imggsc (imdes, vs, ve, ndim, TY_LONG, totpix)
+ if (IM_PIXTYPE(imdes) != TY_LONG)
+ call imupkl (Meml[bp], Meml[bp], totpix, IM_PIXTYPE(imdes))
+ return (bp)
+end
diff --git a/sys/imio/tf/imggsr.x b/sys/imio/tf/imggsr.x
new file mode 100644
index 00000000..37055497
--- /dev/null
+++ b/sys/imio/tf/imggsr.x
@@ -0,0 +1,21 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGGS? -- Get a general section.
+
+pointer procedure imggsr (imdes, vs, ve, ndim)
+
+pointer imdes
+long vs[IM_MAXDIM], ve[IM_MAXDIM]
+int ndim
+long totpix
+pointer bp, imggsc()
+errchk imggsc
+
+begin
+ bp = imggsc (imdes, vs, ve, ndim, TY_REAL, totpix)
+ if (IM_PIXTYPE(imdes) != TY_REAL)
+ call imupkr (Memr[bp], Memr[bp], totpix, IM_PIXTYPE(imdes))
+ return (bp)
+end
diff --git a/sys/imio/tf/imggss.x b/sys/imio/tf/imggss.x
new file mode 100644
index 00000000..f6e3260e
--- /dev/null
+++ b/sys/imio/tf/imggss.x
@@ -0,0 +1,21 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGGS? -- Get a general section.
+
+pointer procedure imggss (imdes, vs, ve, ndim)
+
+pointer imdes
+long vs[IM_MAXDIM], ve[IM_MAXDIM]
+int ndim
+long totpix
+pointer bp, imggsc()
+errchk imggsc
+
+begin
+ bp = imggsc (imdes, vs, ve, ndim, TY_SHORT, totpix)
+ if (IM_PIXTYPE(imdes) != TY_SHORT)
+ call imupks (Mems[bp], Mems[bp], totpix, IM_PIXTYPE(imdes))
+ return (bp)
+end
diff --git a/sys/imio/tf/imggsx.x b/sys/imio/tf/imggsx.x
new file mode 100644
index 00000000..60c029c0
--- /dev/null
+++ b/sys/imio/tf/imggsx.x
@@ -0,0 +1,21 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGGS? -- Get a general section.
+
+pointer procedure imggsx (imdes, vs, ve, ndim)
+
+pointer imdes
+long vs[IM_MAXDIM], ve[IM_MAXDIM]
+int ndim
+long totpix
+pointer bp, imggsc()
+errchk imggsc
+
+begin
+ bp = imggsc (imdes, vs, ve, ndim, TY_COMPLEX, totpix)
+ if (IM_PIXTYPE(imdes) != TY_COMPLEX)
+ call imupkx (Memx[bp], Memx[bp], totpix, IM_PIXTYPE(imdes))
+ return (bp)
+end
diff --git a/sys/imio/tf/imgl1d.x b/sys/imio/tf/imgl1d.x
new file mode 100644
index 00000000..eeab8586
--- /dev/null
+++ b/sys/imio/tf/imgl1d.x
@@ -0,0 +1,35 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMGL1? -- Get a line from an apparently one dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl1d (im)
+
+pointer im
+int fd, nchars
+long offset
+pointer bp, imggsd(), freadp()
+errchk imopsf
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_DOUBLE) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+
+ offset = IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_DOUBLE
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_DOUBLE + 1)
+ return (bp)
+ }
+ return (imggsd (im, long(1), IM_LEN(im,1), 1))
+ }
+end
diff --git a/sys/imio/tf/imgl1i.x b/sys/imio/tf/imgl1i.x
new file mode 100644
index 00000000..0de66fa2
--- /dev/null
+++ b/sys/imio/tf/imgl1i.x
@@ -0,0 +1,35 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMGL1? -- Get a line from an apparently one dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl1i (im)
+
+pointer im
+int fd, nchars
+long offset
+pointer bp, imggsi(), freadp()
+errchk imopsf
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_INT) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+
+ offset = IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_INT
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_INT + 1)
+ return (bp)
+ }
+ return (imggsi (im, long(1), IM_LEN(im,1), 1))
+ }
+end
diff --git a/sys/imio/tf/imgl1l.x b/sys/imio/tf/imgl1l.x
new file mode 100644
index 00000000..a996ce32
--- /dev/null
+++ b/sys/imio/tf/imgl1l.x
@@ -0,0 +1,35 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMGL1? -- Get a line from an apparently one dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl1l (im)
+
+pointer im
+int fd, nchars
+long offset
+pointer bp, imggsl(), freadp()
+errchk imopsf
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_LONG) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+
+ offset = IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_LONG
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_LONG + 1)
+ return (bp)
+ }
+ return (imggsl (im, long(1), IM_LEN(im,1), 1))
+ }
+end
diff --git a/sys/imio/tf/imgl1r.x b/sys/imio/tf/imgl1r.x
new file mode 100644
index 00000000..a3f20de8
--- /dev/null
+++ b/sys/imio/tf/imgl1r.x
@@ -0,0 +1,35 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMGL1? -- Get a line from an apparently one dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl1r (im)
+
+pointer im
+int fd, nchars
+long offset
+pointer bp, imggsr(), freadp()
+errchk imopsf
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_REAL) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+
+ offset = IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_REAL
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_REAL + 1)
+ return (bp)
+ }
+ return (imggsr (im, long(1), IM_LEN(im,1), 1))
+ }
+end
diff --git a/sys/imio/tf/imgl1s.x b/sys/imio/tf/imgl1s.x
new file mode 100644
index 00000000..bd226f31
--- /dev/null
+++ b/sys/imio/tf/imgl1s.x
@@ -0,0 +1,35 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMGL1? -- Get a line from an apparently one dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl1s (im)
+
+pointer im
+int fd, nchars
+long offset
+pointer bp, imggss(), freadp()
+errchk imopsf
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_SHORT) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+
+ offset = IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_SHORT
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_SHORT + 1)
+ return (bp)
+ }
+ return (imggss (im, long(1), IM_LEN(im,1), 1))
+ }
+end
diff --git a/sys/imio/tf/imgl1x.x b/sys/imio/tf/imgl1x.x
new file mode 100644
index 00000000..a7f73ac1
--- /dev/null
+++ b/sys/imio/tf/imgl1x.x
@@ -0,0 +1,35 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMGL1? -- Get a line from an apparently one dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl1x (im)
+
+pointer im
+int fd, nchars
+long offset
+pointer bp, imggsx(), freadp()
+errchk imopsf
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_COMPLEX) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+
+ offset = IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_COMPLEX
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_COMPLEX + 1)
+ return (bp)
+ }
+ return (imggsx (im, long(1), IM_LEN(im,1), 1))
+ }
+end
diff --git a/sys/imio/tf/imgl2d.x b/sys/imio/tf/imgl2d.x
new file mode 100644
index 00000000..dbd7858a
--- /dev/null
+++ b/sys/imio/tf/imgl2d.x
@@ -0,0 +1,47 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMGL2? -- Get a line from an apparently two dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl2d (im, linenum)
+
+pointer im # image header pointer
+int linenum # line to be read
+
+int fd, nchars
+long vs[2], ve[2], offset
+pointer bp, imggsd(), freadp()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_DOUBLE) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (linenum < 1 || linenum > IM_LEN(im,2))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (linenum - 1) * IM_PHYSLEN(im,1) * SZ_DOUBLE +
+ IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_DOUBLE
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_DOUBLE + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = linenum
+ ve[2] = linenum
+
+ return (imggsd (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imgl2i.x b/sys/imio/tf/imgl2i.x
new file mode 100644
index 00000000..9592ebe9
--- /dev/null
+++ b/sys/imio/tf/imgl2i.x
@@ -0,0 +1,47 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMGL2? -- Get a line from an apparently two dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl2i (im, linenum)
+
+pointer im # image header pointer
+int linenum # line to be read
+
+int fd, nchars
+long vs[2], ve[2], offset
+pointer bp, imggsi(), freadp()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_INT) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (linenum < 1 || linenum > IM_LEN(im,2))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (linenum - 1) * IM_PHYSLEN(im,1) * SZ_INT +
+ IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_INT
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_INT + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = linenum
+ ve[2] = linenum
+
+ return (imggsi (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imgl2l.x b/sys/imio/tf/imgl2l.x
new file mode 100644
index 00000000..e3f5d523
--- /dev/null
+++ b/sys/imio/tf/imgl2l.x
@@ -0,0 +1,47 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMGL2? -- Get a line from an apparently two dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl2l (im, linenum)
+
+pointer im # image header pointer
+int linenum # line to be read
+
+int fd, nchars
+long vs[2], ve[2], offset
+pointer bp, imggsl(), freadp()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_LONG) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (linenum < 1 || linenum > IM_LEN(im,2))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (linenum - 1) * IM_PHYSLEN(im,1) * SZ_LONG +
+ IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_LONG
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_LONG + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = linenum
+ ve[2] = linenum
+
+ return (imggsl (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imgl2r.x b/sys/imio/tf/imgl2r.x
new file mode 100644
index 00000000..d487e61b
--- /dev/null
+++ b/sys/imio/tf/imgl2r.x
@@ -0,0 +1,47 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMGL2? -- Get a line from an apparently two dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl2r (im, linenum)
+
+pointer im # image header pointer
+int linenum # line to be read
+
+int fd, nchars
+long vs[2], ve[2], offset
+pointer bp, imggsr(), freadp()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_REAL) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (linenum < 1 || linenum > IM_LEN(im,2))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (linenum - 1) * IM_PHYSLEN(im,1) * SZ_REAL +
+ IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_REAL
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_REAL + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = linenum
+ ve[2] = linenum
+
+ return (imggsr (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imgl2s.x b/sys/imio/tf/imgl2s.x
new file mode 100644
index 00000000..a4fd140b
--- /dev/null
+++ b/sys/imio/tf/imgl2s.x
@@ -0,0 +1,47 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMGL2? -- Get a line from an apparently two dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl2s (im, linenum)
+
+pointer im # image header pointer
+int linenum # line to be read
+
+int fd, nchars
+long vs[2], ve[2], offset
+pointer bp, imggss(), freadp()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_SHORT) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (linenum < 1 || linenum > IM_LEN(im,2))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (linenum - 1) * IM_PHYSLEN(im,1) * SZ_SHORT +
+ IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_SHORT
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_SHORT + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = linenum
+ ve[2] = linenum
+
+ return (imggss (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imgl2x.x b/sys/imio/tf/imgl2x.x
new file mode 100644
index 00000000..7a97ac48
--- /dev/null
+++ b/sys/imio/tf/imgl2x.x
@@ -0,0 +1,47 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMGL2? -- Get a line from an apparently two dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl2x (im, linenum)
+
+pointer im # image header pointer
+int linenum # line to be read
+
+int fd, nchars
+long vs[2], ve[2], offset
+pointer bp, imggsx(), freadp()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_COMPLEX) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (linenum < 1 || linenum > IM_LEN(im,2))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (linenum - 1) * IM_PHYSLEN(im,1) * SZ_COMPLEX +
+ IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_COMPLEX
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_COMPLEX + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = linenum
+ ve[2] = linenum
+
+ return (imggsx (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imgl3d.x b/sys/imio/tf/imgl3d.x
new file mode 100644
index 00000000..735cc4d1
--- /dev/null
+++ b/sys/imio/tf/imgl3d.x
@@ -0,0 +1,51 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMGL3? -- Get a line from an apparently three dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl3d (im, line, band)
+
+pointer im # image header pointer
+int line # line number within band
+int band # band number
+
+int fd, nchars
+long vs[3], ve[3], offset
+pointer bp, imggsd(), freadp()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_DOUBLE) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (line < 1 || line > IM_LEN(im,2) ||
+ band < 1 || band > IM_LEN(im,3))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (((band - 1) * IM_PHYSLEN(im,2) + line - 1) *
+ IM_PHYSLEN(im,1)) * SZ_DOUBLE + IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_DOUBLE
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_DOUBLE + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = line
+ ve[2] = line
+ vs[3] = band
+ ve[3] = band
+
+ return (imggsd (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imgl3i.x b/sys/imio/tf/imgl3i.x
new file mode 100644
index 00000000..75a87d36
--- /dev/null
+++ b/sys/imio/tf/imgl3i.x
@@ -0,0 +1,51 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMGL3? -- Get a line from an apparently three dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl3i (im, line, band)
+
+pointer im # image header pointer
+int line # line number within band
+int band # band number
+
+int fd, nchars
+long vs[3], ve[3], offset
+pointer bp, imggsi(), freadp()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_INT) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (line < 1 || line > IM_LEN(im,2) ||
+ band < 1 || band > IM_LEN(im,3))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (((band - 1) * IM_PHYSLEN(im,2) + line - 1) *
+ IM_PHYSLEN(im,1)) * SZ_INT + IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_INT
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_INT + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = line
+ ve[2] = line
+ vs[3] = band
+ ve[3] = band
+
+ return (imggsi (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imgl3l.x b/sys/imio/tf/imgl3l.x
new file mode 100644
index 00000000..e18f8d3e
--- /dev/null
+++ b/sys/imio/tf/imgl3l.x
@@ -0,0 +1,51 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMGL3? -- Get a line from an apparently three dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl3l (im, line, band)
+
+pointer im # image header pointer
+int line # line number within band
+int band # band number
+
+int fd, nchars
+long vs[3], ve[3], offset
+pointer bp, imggsl(), freadp()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_LONG) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (line < 1 || line > IM_LEN(im,2) ||
+ band < 1 || band > IM_LEN(im,3))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (((band - 1) * IM_PHYSLEN(im,2) + line - 1) *
+ IM_PHYSLEN(im,1)) * SZ_LONG + IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_LONG
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_LONG + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = line
+ ve[2] = line
+ vs[3] = band
+ ve[3] = band
+
+ return (imggsl (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imgl3r.x b/sys/imio/tf/imgl3r.x
new file mode 100644
index 00000000..428e55aa
--- /dev/null
+++ b/sys/imio/tf/imgl3r.x
@@ -0,0 +1,51 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMGL3? -- Get a line from an apparently three dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl3r (im, line, band)
+
+pointer im # image header pointer
+int line # line number within band
+int band # band number
+
+int fd, nchars
+long vs[3], ve[3], offset
+pointer bp, imggsr(), freadp()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_REAL) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (line < 1 || line > IM_LEN(im,2) ||
+ band < 1 || band > IM_LEN(im,3))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (((band - 1) * IM_PHYSLEN(im,2) + line - 1) *
+ IM_PHYSLEN(im,1)) * SZ_REAL + IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_REAL
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_REAL + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = line
+ ve[2] = line
+ vs[3] = band
+ ve[3] = band
+
+ return (imggsr (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imgl3s.x b/sys/imio/tf/imgl3s.x
new file mode 100644
index 00000000..32cd0625
--- /dev/null
+++ b/sys/imio/tf/imgl3s.x
@@ -0,0 +1,51 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMGL3? -- Get a line from an apparently three dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl3s (im, line, band)
+
+pointer im # image header pointer
+int line # line number within band
+int band # band number
+
+int fd, nchars
+long vs[3], ve[3], offset
+pointer bp, imggss(), freadp()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_SHORT) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (line < 1 || line > IM_LEN(im,2) ||
+ band < 1 || band > IM_LEN(im,3))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (((band - 1) * IM_PHYSLEN(im,2) + line - 1) *
+ IM_PHYSLEN(im,1)) * SZ_SHORT + IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_SHORT
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_SHORT + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = line
+ ve[2] = line
+ vs[3] = band
+ ve[3] = band
+
+ return (imggss (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imgl3x.x b/sys/imio/tf/imgl3x.x
new file mode 100644
index 00000000..9ba1052d
--- /dev/null
+++ b/sys/imio/tf/imgl3x.x
@@ -0,0 +1,51 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMGL3? -- Get a line from an apparently three dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure imgl3x (im, line, band)
+
+pointer im # image header pointer
+int line # line number within band
+int band # band number
+
+int fd, nchars
+long vs[3], ve[3], offset
+pointer bp, imggsx(), freadp()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_COMPLEX) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (line < 1 || line > IM_LEN(im,2) ||
+ band < 1 || band > IM_LEN(im,3))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (((band - 1) * IM_PHYSLEN(im,2) + line - 1) *
+ IM_PHYSLEN(im,1)) * SZ_COMPLEX + IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_COMPLEX
+ ifnoerr (bp = (freadp (fd, offset, nchars) - 1) / SZ_COMPLEX + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = line
+ ve[2] = line
+ vs[3] = band
+ ve[3] = band
+
+ return (imggsx (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imgnld.x b/sys/imio/tf/imgnld.x
new file mode 100644
index 00000000..55b27360
--- /dev/null
+++ b/sys/imio/tf/imgnld.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGNL -- Get the next line from an image of any dimension or datatype.
+# This is a sequential operator. The index vector V should be initialized
+# to the first line to be read before the first call. Each call increments
+# the leftmost subscript by one, until V equals IM_LEN, at which time EOF
+# is returned.
+
+int procedure imgnld (imdes, lineptr, v)
+
+pointer imdes
+pointer lineptr # on output, points to the pixels
+long v[IM_MAXDIM] # loop counter
+int npix, dtype, imgnln()
+errchk imgnln
+
+begin
+ npix = imgnln (imdes, lineptr, v, TY_DOUBLE)
+
+ if (npix != EOF) {
+ dtype = IM_PIXTYPE(imdes)
+ if (dtype != TY_DOUBLE)
+ call imupkd (Memd[lineptr], Memd[lineptr], npix, dtype)
+ }
+
+ return (npix)
+end
diff --git a/sys/imio/tf/imgnli.x b/sys/imio/tf/imgnli.x
new file mode 100644
index 00000000..1b9ed846
--- /dev/null
+++ b/sys/imio/tf/imgnli.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGNL -- Get the next line from an image of any dimension or datatype.
+# This is a sequential operator. The index vector V should be initialized
+# to the first line to be read before the first call. Each call increments
+# the leftmost subscript by one, until V equals IM_LEN, at which time EOF
+# is returned.
+
+int procedure imgnli (imdes, lineptr, v)
+
+pointer imdes
+pointer lineptr # on output, points to the pixels
+long v[IM_MAXDIM] # loop counter
+int npix, dtype, imgnln()
+errchk imgnln
+
+begin
+ npix = imgnln (imdes, lineptr, v, TY_INT)
+
+ if (npix != EOF) {
+ dtype = IM_PIXTYPE(imdes)
+ if (dtype != TY_INT)
+ call imupki (Memi[lineptr], Memi[lineptr], npix, dtype)
+ }
+
+ return (npix)
+end
diff --git a/sys/imio/tf/imgnll.x b/sys/imio/tf/imgnll.x
new file mode 100644
index 00000000..81c4fc44
--- /dev/null
+++ b/sys/imio/tf/imgnll.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGNL -- Get the next line from an image of any dimension or datatype.
+# This is a sequential operator. The index vector V should be initialized
+# to the first line to be read before the first call. Each call increments
+# the leftmost subscript by one, until V equals IM_LEN, at which time EOF
+# is returned.
+
+int procedure imgnll (imdes, lineptr, v)
+
+pointer imdes
+pointer lineptr # on output, points to the pixels
+long v[IM_MAXDIM] # loop counter
+int npix, dtype, imgnln()
+errchk imgnln
+
+begin
+ npix = imgnln (imdes, lineptr, v, TY_LONG)
+
+ if (npix != EOF) {
+ dtype = IM_PIXTYPE(imdes)
+ if (dtype != TY_LONG)
+ call imupkl (Meml[lineptr], Meml[lineptr], npix, dtype)
+ }
+
+ return (npix)
+end
diff --git a/sys/imio/tf/imgnlr.x b/sys/imio/tf/imgnlr.x
new file mode 100644
index 00000000..b14c96bb
--- /dev/null
+++ b/sys/imio/tf/imgnlr.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGNL -- Get the next line from an image of any dimension or datatype.
+# This is a sequential operator. The index vector V should be initialized
+# to the first line to be read before the first call. Each call increments
+# the leftmost subscript by one, until V equals IM_LEN, at which time EOF
+# is returned.
+
+int procedure imgnlr (imdes, lineptr, v)
+
+pointer imdes
+pointer lineptr # on output, points to the pixels
+long v[IM_MAXDIM] # loop counter
+int npix, dtype, imgnln()
+errchk imgnln
+
+begin
+ npix = imgnln (imdes, lineptr, v, TY_REAL)
+
+ if (npix != EOF) {
+ dtype = IM_PIXTYPE(imdes)
+ if (dtype != TY_REAL)
+ call imupkr (Memr[lineptr], Memr[lineptr], npix, dtype)
+ }
+
+ return (npix)
+end
diff --git a/sys/imio/tf/imgnls.x b/sys/imio/tf/imgnls.x
new file mode 100644
index 00000000..ce962df6
--- /dev/null
+++ b/sys/imio/tf/imgnls.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGNL -- Get the next line from an image of any dimension or datatype.
+# This is a sequential operator. The index vector V should be initialized
+# to the first line to be read before the first call. Each call increments
+# the leftmost subscript by one, until V equals IM_LEN, at which time EOF
+# is returned.
+
+int procedure imgnls (imdes, lineptr, v)
+
+pointer imdes
+pointer lineptr # on output, points to the pixels
+long v[IM_MAXDIM] # loop counter
+int npix, dtype, imgnln()
+errchk imgnln
+
+begin
+ npix = imgnln (imdes, lineptr, v, TY_SHORT)
+
+ if (npix != EOF) {
+ dtype = IM_PIXTYPE(imdes)
+ if (dtype != TY_SHORT)
+ call imupks (Mems[lineptr], Mems[lineptr], npix, dtype)
+ }
+
+ return (npix)
+end
diff --git a/sys/imio/tf/imgnlx.x b/sys/imio/tf/imgnlx.x
new file mode 100644
index 00000000..76075a49
--- /dev/null
+++ b/sys/imio/tf/imgnlx.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGNL -- Get the next line from an image of any dimension or datatype.
+# This is a sequential operator. The index vector V should be initialized
+# to the first line to be read before the first call. Each call increments
+# the leftmost subscript by one, until V equals IM_LEN, at which time EOF
+# is returned.
+
+int procedure imgnlx (imdes, lineptr, v)
+
+pointer imdes
+pointer lineptr # on output, points to the pixels
+long v[IM_MAXDIM] # loop counter
+int npix, dtype, imgnln()
+errchk imgnln
+
+begin
+ npix = imgnln (imdes, lineptr, v, TY_COMPLEX)
+
+ if (npix != EOF) {
+ dtype = IM_PIXTYPE(imdes)
+ if (dtype != TY_COMPLEX)
+ call imupkx (Memx[lineptr], Memx[lineptr], npix, dtype)
+ }
+
+ return (npix)
+end
diff --git a/sys/imio/tf/imgs1d.x b/sys/imio/tf/imgs1d.x
new file mode 100644
index 00000000..5ab52b92
--- /dev/null
+++ b/sys/imio/tf/imgs1d.x
@@ -0,0 +1,18 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS1? -- Get a section from an apparently one dimensional image.
+
+pointer procedure imgs1d (im, x1, x2)
+
+pointer im
+int x1, x2
+pointer imggsd(), imgl1d()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1))
+ return (imgl1d (im))
+ else
+ return (imggsd (im, long(x1), long(x2), 1))
+end
diff --git a/sys/imio/tf/imgs1i.x b/sys/imio/tf/imgs1i.x
new file mode 100644
index 00000000..ddb0a435
--- /dev/null
+++ b/sys/imio/tf/imgs1i.x
@@ -0,0 +1,18 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS1? -- Get a section from an apparently one dimensional image.
+
+pointer procedure imgs1i (im, x1, x2)
+
+pointer im
+int x1, x2
+pointer imggsi(), imgl1i()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1))
+ return (imgl1i (im))
+ else
+ return (imggsi (im, long(x1), long(x2), 1))
+end
diff --git a/sys/imio/tf/imgs1l.x b/sys/imio/tf/imgs1l.x
new file mode 100644
index 00000000..5f3610c9
--- /dev/null
+++ b/sys/imio/tf/imgs1l.x
@@ -0,0 +1,18 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS1? -- Get a section from an apparently one dimensional image.
+
+pointer procedure imgs1l (im, x1, x2)
+
+pointer im
+int x1, x2
+pointer imggsl(), imgl1l()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1))
+ return (imgl1l (im))
+ else
+ return (imggsl (im, long(x1), long(x2), 1))
+end
diff --git a/sys/imio/tf/imgs1r.x b/sys/imio/tf/imgs1r.x
new file mode 100644
index 00000000..9d5da6d4
--- /dev/null
+++ b/sys/imio/tf/imgs1r.x
@@ -0,0 +1,18 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS1? -- Get a section from an apparently one dimensional image.
+
+pointer procedure imgs1r (im, x1, x2)
+
+pointer im
+int x1, x2
+pointer imggsr(), imgl1r()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1))
+ return (imgl1r (im))
+ else
+ return (imggsr (im, long(x1), long(x2), 1))
+end
diff --git a/sys/imio/tf/imgs1s.x b/sys/imio/tf/imgs1s.x
new file mode 100644
index 00000000..fc15aac3
--- /dev/null
+++ b/sys/imio/tf/imgs1s.x
@@ -0,0 +1,18 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS1? -- Get a section from an apparently one dimensional image.
+
+pointer procedure imgs1s (im, x1, x2)
+
+pointer im
+int x1, x2
+pointer imggss(), imgl1s()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1))
+ return (imgl1s (im))
+ else
+ return (imggss (im, long(x1), long(x2), 1))
+end
diff --git a/sys/imio/tf/imgs1x.x b/sys/imio/tf/imgs1x.x
new file mode 100644
index 00000000..7bb64465
--- /dev/null
+++ b/sys/imio/tf/imgs1x.x
@@ -0,0 +1,18 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS1? -- Get a section from an apparently one dimensional image.
+
+pointer procedure imgs1x (im, x1, x2)
+
+pointer im
+int x1, x2
+pointer imggsx(), imgl1x()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1))
+ return (imgl1x (im))
+ else
+ return (imggsx (im, long(x1), long(x2), 1))
+end
diff --git a/sys/imio/tf/imgs2d.x b/sys/imio/tf/imgs2d.x
new file mode 100644
index 00000000..4c8f5f71
--- /dev/null
+++ b/sys/imio/tf/imgs2d.x
@@ -0,0 +1,26 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS2? -- Get a section from an apparently two dimensional image.
+
+pointer procedure imgs2d (im, x1, x2, y1, y2)
+
+pointer im
+int x1, x2, y1, y2
+long vs[2], ve[2]
+pointer imggsd(), imgl2d()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2)
+ return (imgl2d (im, y1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ return (imggsd (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imgs2i.x b/sys/imio/tf/imgs2i.x
new file mode 100644
index 00000000..fe0c8d1e
--- /dev/null
+++ b/sys/imio/tf/imgs2i.x
@@ -0,0 +1,26 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS2? -- Get a section from an apparently two dimensional image.
+
+pointer procedure imgs2i (im, x1, x2, y1, y2)
+
+pointer im
+int x1, x2, y1, y2
+long vs[2], ve[2]
+pointer imggsi(), imgl2i()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2)
+ return (imgl2i (im, y1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ return (imggsi (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imgs2l.x b/sys/imio/tf/imgs2l.x
new file mode 100644
index 00000000..00fe004e
--- /dev/null
+++ b/sys/imio/tf/imgs2l.x
@@ -0,0 +1,26 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS2? -- Get a section from an apparently two dimensional image.
+
+pointer procedure imgs2l (im, x1, x2, y1, y2)
+
+pointer im
+int x1, x2, y1, y2
+long vs[2], ve[2]
+pointer imggsl(), imgl2l()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2)
+ return (imgl2l (im, y1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ return (imggsl (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imgs2r.x b/sys/imio/tf/imgs2r.x
new file mode 100644
index 00000000..7847908a
--- /dev/null
+++ b/sys/imio/tf/imgs2r.x
@@ -0,0 +1,26 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS2? -- Get a section from an apparently two dimensional image.
+
+pointer procedure imgs2r (im, x1, x2, y1, y2)
+
+pointer im
+int x1, x2, y1, y2
+long vs[2], ve[2]
+pointer imggsr(), imgl2r()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2)
+ return (imgl2r (im, y1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ return (imggsr (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imgs2s.x b/sys/imio/tf/imgs2s.x
new file mode 100644
index 00000000..209debe4
--- /dev/null
+++ b/sys/imio/tf/imgs2s.x
@@ -0,0 +1,26 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS2? -- Get a section from an apparently two dimensional image.
+
+pointer procedure imgs2s (im, x1, x2, y1, y2)
+
+pointer im
+int x1, x2, y1, y2
+long vs[2], ve[2]
+pointer imggss(), imgl2s()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2)
+ return (imgl2s (im, y1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ return (imggss (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imgs2x.x b/sys/imio/tf/imgs2x.x
new file mode 100644
index 00000000..3ff5bdc4
--- /dev/null
+++ b/sys/imio/tf/imgs2x.x
@@ -0,0 +1,26 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS2? -- Get a section from an apparently two dimensional image.
+
+pointer procedure imgs2x (im, x1, x2, y1, y2)
+
+pointer im
+int x1, x2, y1, y2
+long vs[2], ve[2]
+pointer imggsx(), imgl2x()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2)
+ return (imgl2x (im, y1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ return (imggsx (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imgs3d.x b/sys/imio/tf/imgs3d.x
new file mode 100644
index 00000000..32c1dab8
--- /dev/null
+++ b/sys/imio/tf/imgs3d.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS3? -- Get a section from an apparently three dimensional image.
+
+pointer procedure imgs3d (im, x1, x2, y1, y2, z1, z2)
+
+pointer im
+int x1, x2, y1, y2, z1, z2
+long vs[3], ve[3]
+pointer imggsd(), imgl3d()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2 && z1 == z2)
+ return (imgl3d (im, y1, z1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ vs[3] = z1
+ ve[3] = z2
+
+ return (imggsd (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imgs3i.x b/sys/imio/tf/imgs3i.x
new file mode 100644
index 00000000..a231130f
--- /dev/null
+++ b/sys/imio/tf/imgs3i.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS3? -- Get a section from an apparently three dimensional image.
+
+pointer procedure imgs3i (im, x1, x2, y1, y2, z1, z2)
+
+pointer im
+int x1, x2, y1, y2, z1, z2
+long vs[3], ve[3]
+pointer imggsi(), imgl3i()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2 && z1 == z2)
+ return (imgl3i (im, y1, z1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ vs[3] = z1
+ ve[3] = z2
+
+ return (imggsi (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imgs3l.x b/sys/imio/tf/imgs3l.x
new file mode 100644
index 00000000..5f1294b0
--- /dev/null
+++ b/sys/imio/tf/imgs3l.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS3? -- Get a section from an apparently three dimensional image.
+
+pointer procedure imgs3l (im, x1, x2, y1, y2, z1, z2)
+
+pointer im
+int x1, x2, y1, y2, z1, z2
+long vs[3], ve[3]
+pointer imggsl(), imgl3l()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2 && z1 == z2)
+ return (imgl3l (im, y1, z1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ vs[3] = z1
+ ve[3] = z2
+
+ return (imggsl (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imgs3r.x b/sys/imio/tf/imgs3r.x
new file mode 100644
index 00000000..54bd0667
--- /dev/null
+++ b/sys/imio/tf/imgs3r.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS3? -- Get a section from an apparently three dimensional image.
+
+pointer procedure imgs3r (im, x1, x2, y1, y2, z1, z2)
+
+pointer im
+int x1, x2, y1, y2, z1, z2
+long vs[3], ve[3]
+pointer imggsr(), imgl3r()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2 && z1 == z2)
+ return (imgl3r (im, y1, z1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ vs[3] = z1
+ ve[3] = z2
+
+ return (imggsr (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imgs3s.x b/sys/imio/tf/imgs3s.x
new file mode 100644
index 00000000..b0692edb
--- /dev/null
+++ b/sys/imio/tf/imgs3s.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS3? -- Get a section from an apparently three dimensional image.
+
+pointer procedure imgs3s (im, x1, x2, y1, y2, z1, z2)
+
+pointer im
+int x1, x2, y1, y2, z1, z2
+long vs[3], ve[3]
+pointer imggss(), imgl3s()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2 && z1 == z2)
+ return (imgl3s (im, y1, z1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ vs[3] = z1
+ ve[3] = z2
+
+ return (imggss (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imgs3x.x b/sys/imio/tf/imgs3x.x
new file mode 100644
index 00000000..f621fe4c
--- /dev/null
+++ b/sys/imio/tf/imgs3x.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMGS3? -- Get a section from an apparently three dimensional image.
+
+pointer procedure imgs3x (im, x1, x2, y1, y2, z1, z2)
+
+pointer im
+int x1, x2, y1, y2, z1, z2
+long vs[3], ve[3]
+pointer imggsx(), imgl3x()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2 && z1 == z2)
+ return (imgl3x (im, y1, z1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ vs[3] = z1
+ ve[3] = z2
+
+ return (imggsx (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/impakd.x b/sys/imio/tf/impakd.x
new file mode 100644
index 00000000..060ef4d5
--- /dev/null
+++ b/sys/imio/tf/impakd.x
@@ -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 impakd (a, b, npix, dtype)
+
+double a[npix]
+int b[npix], npix, dtype
+
+pointer bp
+
+begin
+ switch (dtype) {
+ case TY_USHORT:
+ call achtdu (a, b, npix)
+ case TY_SHORT:
+ call achtds (a, b, npix)
+ case TY_INT:
+ if (SZ_INT == SZ_INT32)
+ call achtdi (a, b, npix)
+ else {
+ call malloc (bp, npix, TY_INT)
+ call achtdi (a, Memi[bp], npix)
+ call ipak32 (Memi[bp], b, npix)
+ call mfree (bp, TY_INT)
+ }
+ case TY_LONG:
+ if (SZ_INT == SZ_INT32)
+ call achtdl (a, b, npix)
+ else {
+ call malloc (bp, npix, TY_LONG)
+ call achtdl (a, Meml[bp], npix)
+ call ipak32 (Meml[bp], b, npix)
+ call mfree (bp, TY_LONG)
+ }
+ case TY_REAL:
+ call achtdr (a, b, npix)
+ case TY_DOUBLE:
+ call achtdd (a, b, npix)
+ case TY_COMPLEX:
+ call achtdx (a, b, npix)
+ default:
+ call error (1, "Unknown datatype in imagefile")
+ }
+end
diff --git a/sys/imio/tf/impaki.x b/sys/imio/tf/impaki.x
new file mode 100644
index 00000000..5d197add
--- /dev/null
+++ b/sys/imio/tf/impaki.x
@@ -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 impaki (a, b, npix, dtype)
+
+int a[npix]
+int b[npix], npix, dtype
+
+pointer bp
+
+begin
+ switch (dtype) {
+ case TY_USHORT:
+ call achtiu (a, b, npix)
+ case TY_SHORT:
+ call achtis (a, b, npix)
+ case TY_INT:
+ if (SZ_INT == SZ_INT32)
+ call achtii (a, b, npix)
+ else {
+ call malloc (bp, npix, TY_INT)
+ call achtii (a, Memi[bp], npix)
+ call ipak32 (Memi[bp], b, npix)
+ call mfree (bp, TY_INT)
+ }
+ case TY_LONG:
+ if (SZ_INT == SZ_INT32)
+ call achtil (a, b, npix)
+ else {
+ call malloc (bp, npix, TY_LONG)
+ call achtil (a, Meml[bp], npix)
+ call ipak32 (Meml[bp], b, npix)
+ call mfree (bp, TY_LONG)
+ }
+ case TY_REAL:
+ call achtir (a, b, npix)
+ case TY_DOUBLE:
+ call achtid (a, b, npix)
+ case TY_COMPLEX:
+ call achtix (a, b, npix)
+ default:
+ call error (1, "Unknown datatype in imagefile")
+ }
+end
diff --git a/sys/imio/tf/impakl.x b/sys/imio/tf/impakl.x
new file mode 100644
index 00000000..884f931b
--- /dev/null
+++ b/sys/imio/tf/impakl.x
@@ -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 impakl (a, b, npix, dtype)
+
+long a[npix]
+int b[npix], npix, dtype
+
+pointer bp
+
+begin
+ switch (dtype) {
+ case TY_USHORT:
+ call achtlu (a, b, npix)
+ case TY_SHORT:
+ call achtls (a, b, npix)
+ case TY_INT:
+ if (SZ_INT == SZ_INT32)
+ call achtli (a, b, npix)
+ else {
+ call malloc (bp, npix, TY_INT)
+ call achtli (a, Memi[bp], npix)
+ call ipak32 (Memi[bp], b, npix)
+ call mfree (bp, TY_INT)
+ }
+ case TY_LONG:
+ if (SZ_INT == SZ_INT32)
+ call achtll (a, b, npix)
+ else {
+ call malloc (bp, npix, TY_LONG)
+ call achtll (a, Meml[bp], npix)
+ call ipak32 (Meml[bp], b, npix)
+ call mfree (bp, TY_LONG)
+ }
+ case TY_REAL:
+ call achtlr (a, b, npix)
+ case TY_DOUBLE:
+ call achtld (a, b, npix)
+ case TY_COMPLEX:
+ call achtlx (a, b, npix)
+ default:
+ call error (1, "Unknown datatype in imagefile")
+ }
+end
diff --git a/sys/imio/tf/impakr.x b/sys/imio/tf/impakr.x
new file mode 100644
index 00000000..867554ce
--- /dev/null
+++ b/sys/imio/tf/impakr.x
@@ -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 impakr (a, b, npix, dtype)
+
+real a[npix]
+int b[npix], npix, dtype
+
+pointer bp
+
+begin
+ switch (dtype) {
+ case TY_USHORT:
+ call achtru (a, b, npix)
+ case TY_SHORT:
+ call achtrs (a, b, npix)
+ case TY_INT:
+ if (SZ_INT == SZ_INT32)
+ call achtri (a, b, npix)
+ else {
+ call malloc (bp, npix, TY_INT)
+ call achtri (a, Memi[bp], npix)
+ call ipak32 (Memi[bp], b, npix)
+ call mfree (bp, TY_INT)
+ }
+ case TY_LONG:
+ if (SZ_INT == SZ_INT32)
+ call achtrl (a, b, npix)
+ else {
+ call malloc (bp, npix, TY_LONG)
+ call achtrl (a, Meml[bp], npix)
+ call ipak32 (Meml[bp], b, npix)
+ call mfree (bp, TY_LONG)
+ }
+ case TY_REAL:
+ call achtrr (a, b, npix)
+ case TY_DOUBLE:
+ call achtrd (a, b, npix)
+ case TY_COMPLEX:
+ call achtrx (a, b, npix)
+ default:
+ call error (1, "Unknown datatype in imagefile")
+ }
+end
diff --git a/sys/imio/tf/impaks.x b/sys/imio/tf/impaks.x
new file mode 100644
index 00000000..40168707
--- /dev/null
+++ b/sys/imio/tf/impaks.x
@@ -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 impaks (a, b, npix, dtype)
+
+short a[npix]
+int b[npix], npix, dtype
+
+pointer bp
+
+begin
+ switch (dtype) {
+ case TY_USHORT:
+ call achtsu (a, b, npix)
+ case TY_SHORT:
+ call achtss (a, b, npix)
+ case TY_INT:
+ if (SZ_INT == SZ_INT32)
+ call achtsi (a, b, npix)
+ else {
+ call malloc (bp, npix, TY_INT)
+ call achtsi (a, Memi[bp], npix)
+ call ipak32 (Memi[bp], b, npix)
+ call mfree (bp, TY_INT)
+ }
+ case TY_LONG:
+ if (SZ_INT == SZ_INT32)
+ call achtsl (a, b, npix)
+ else {
+ call malloc (bp, npix, TY_LONG)
+ call achtsl (a, Meml[bp], npix)
+ call ipak32 (Meml[bp], b, npix)
+ call mfree (bp, TY_LONG)
+ }
+ case TY_REAL:
+ call achtsr (a, b, npix)
+ case TY_DOUBLE:
+ call achtsd (a, b, npix)
+ case TY_COMPLEX:
+ call achtsx (a, b, npix)
+ default:
+ call error (1, "Unknown datatype in imagefile")
+ }
+end
diff --git a/sys/imio/tf/impakx.x b/sys/imio/tf/impakx.x
new file mode 100644
index 00000000..1bfcffb9
--- /dev/null
+++ b/sys/imio/tf/impakx.x
@@ -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 impakx (a, b, npix, dtype)
+
+complex a[npix]
+int b[npix], npix, dtype
+
+pointer bp
+
+begin
+ switch (dtype) {
+ case TY_USHORT:
+ call achtxu (a, b, npix)
+ case TY_SHORT:
+ call achtxs (a, b, npix)
+ case TY_INT:
+ if (SZ_INT == SZ_INT32)
+ call achtxi (a, b, npix)
+ else {
+ call malloc (bp, npix, TY_INT)
+ call achtxi (a, Memi[bp], npix)
+ call ipak32 (Memi[bp], b, npix)
+ call mfree (bp, TY_INT)
+ }
+ case TY_LONG:
+ if (SZ_INT == SZ_INT32)
+ call achtxl (a, b, npix)
+ else {
+ call malloc (bp, npix, TY_LONG)
+ call achtxl (a, Meml[bp], npix)
+ call ipak32 (Meml[bp], b, npix)
+ call mfree (bp, TY_LONG)
+ }
+ case TY_REAL:
+ call achtxr (a, b, npix)
+ case TY_DOUBLE:
+ call achtxd (a, b, npix)
+ case TY_COMPLEX:
+ call achtxx (a, b, npix)
+ default:
+ call error (1, "Unknown datatype in imagefile")
+ }
+end
diff --git a/sys/imio/tf/impgsd.x b/sys/imio/tf/impgsd.x
new file mode 100644
index 00000000..c298816e
--- /dev/null
+++ b/sys/imio/tf/impgsd.x
@@ -0,0 +1,33 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPGS? -- Put a general section of a specific datatype.
+
+pointer procedure impgsd (imdes, vs, ve, ndim)
+
+pointer imdes
+long vs[IM_MAXDIM], ve[IM_MAXDIM]
+pointer bp, imgobf()
+int ndim
+extern imflsd()
+errchk imflush, imgobf
+
+begin
+ # Flush the output buffer, if appropriate. IMFLUSH calls
+ # one of the IMFLS? routines, which write out the section.
+
+ if (IM_FLUSH(imdes) == YES)
+ call zcall1 (IM_FLUSHEPA(imdes), imdes)
+
+ # Get an (output) buffer to put the pixels into. Save the
+ # section parameters in the image descriptor. Save the epa
+ # of the typed flush procedure in the image descriptor.
+
+ bp = imgobf (imdes, vs, ve, ndim, TY_DOUBLE)
+ call zlocpr (imflsd, IM_FLUSHEPA(imdes))
+ IM_FLUSH(imdes) = YES
+
+ return (bp)
+end
diff --git a/sys/imio/tf/impgsi.x b/sys/imio/tf/impgsi.x
new file mode 100644
index 00000000..62f69105
--- /dev/null
+++ b/sys/imio/tf/impgsi.x
@@ -0,0 +1,33 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPGS? -- Put a general section of a specific datatype.
+
+pointer procedure impgsi (imdes, vs, ve, ndim)
+
+pointer imdes
+long vs[IM_MAXDIM], ve[IM_MAXDIM]
+pointer bp, imgobf()
+int ndim
+extern imflsi()
+errchk imflush, imgobf
+
+begin
+ # Flush the output buffer, if appropriate. IMFLUSH calls
+ # one of the IMFLS? routines, which write out the section.
+
+ if (IM_FLUSH(imdes) == YES)
+ call zcall1 (IM_FLUSHEPA(imdes), imdes)
+
+ # Get an (output) buffer to put the pixels into. Save the
+ # section parameters in the image descriptor. Save the epa
+ # of the typed flush procedure in the image descriptor.
+
+ bp = imgobf (imdes, vs, ve, ndim, TY_INT)
+ call zlocpr (imflsi, IM_FLUSHEPA(imdes))
+ IM_FLUSH(imdes) = YES
+
+ return (bp)
+end
diff --git a/sys/imio/tf/impgsl.x b/sys/imio/tf/impgsl.x
new file mode 100644
index 00000000..d791b4fd
--- /dev/null
+++ b/sys/imio/tf/impgsl.x
@@ -0,0 +1,33 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPGS? -- Put a general section of a specific datatype.
+
+pointer procedure impgsl (imdes, vs, ve, ndim)
+
+pointer imdes
+long vs[IM_MAXDIM], ve[IM_MAXDIM]
+pointer bp, imgobf()
+int ndim
+extern imflsl()
+errchk imflush, imgobf
+
+begin
+ # Flush the output buffer, if appropriate. IMFLUSH calls
+ # one of the IMFLS? routines, which write out the section.
+
+ if (IM_FLUSH(imdes) == YES)
+ call zcall1 (IM_FLUSHEPA(imdes), imdes)
+
+ # Get an (output) buffer to put the pixels into. Save the
+ # section parameters in the image descriptor. Save the epa
+ # of the typed flush procedure in the image descriptor.
+
+ bp = imgobf (imdes, vs, ve, ndim, TY_LONG)
+ call zlocpr (imflsl, IM_FLUSHEPA(imdes))
+ IM_FLUSH(imdes) = YES
+
+ return (bp)
+end
diff --git a/sys/imio/tf/impgsr.x b/sys/imio/tf/impgsr.x
new file mode 100644
index 00000000..46938707
--- /dev/null
+++ b/sys/imio/tf/impgsr.x
@@ -0,0 +1,33 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPGS? -- Put a general section of a specific datatype.
+
+pointer procedure impgsr (imdes, vs, ve, ndim)
+
+pointer imdes
+long vs[IM_MAXDIM], ve[IM_MAXDIM]
+pointer bp, imgobf()
+int ndim
+extern imflsr()
+errchk imflush, imgobf
+
+begin
+ # Flush the output buffer, if appropriate. IMFLUSH calls
+ # one of the IMFLS? routines, which write out the section.
+
+ if (IM_FLUSH(imdes) == YES)
+ call zcall1 (IM_FLUSHEPA(imdes), imdes)
+
+ # Get an (output) buffer to put the pixels into. Save the
+ # section parameters in the image descriptor. Save the epa
+ # of the typed flush procedure in the image descriptor.
+
+ bp = imgobf (imdes, vs, ve, ndim, TY_REAL)
+ call zlocpr (imflsr, IM_FLUSHEPA(imdes))
+ IM_FLUSH(imdes) = YES
+
+ return (bp)
+end
diff --git a/sys/imio/tf/impgss.x b/sys/imio/tf/impgss.x
new file mode 100644
index 00000000..bcdf26e0
--- /dev/null
+++ b/sys/imio/tf/impgss.x
@@ -0,0 +1,33 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPGS? -- Put a general section of a specific datatype.
+
+pointer procedure impgss (imdes, vs, ve, ndim)
+
+pointer imdes
+long vs[IM_MAXDIM], ve[IM_MAXDIM]
+pointer bp, imgobf()
+int ndim
+extern imflss()
+errchk imflush, imgobf
+
+begin
+ # Flush the output buffer, if appropriate. IMFLUSH calls
+ # one of the IMFLS? routines, which write out the section.
+
+ if (IM_FLUSH(imdes) == YES)
+ call zcall1 (IM_FLUSHEPA(imdes), imdes)
+
+ # Get an (output) buffer to put the pixels into. Save the
+ # section parameters in the image descriptor. Save the epa
+ # of the typed flush procedure in the image descriptor.
+
+ bp = imgobf (imdes, vs, ve, ndim, TY_SHORT)
+ call zlocpr (imflss, IM_FLUSHEPA(imdes))
+ IM_FLUSH(imdes) = YES
+
+ return (bp)
+end
diff --git a/sys/imio/tf/impgsx.x b/sys/imio/tf/impgsx.x
new file mode 100644
index 00000000..bb56c9aa
--- /dev/null
+++ b/sys/imio/tf/impgsx.x
@@ -0,0 +1,33 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPGS? -- Put a general section of a specific datatype.
+
+pointer procedure impgsx (imdes, vs, ve, ndim)
+
+pointer imdes
+long vs[IM_MAXDIM], ve[IM_MAXDIM]
+pointer bp, imgobf()
+int ndim
+extern imflsx()
+errchk imflush, imgobf
+
+begin
+ # Flush the output buffer, if appropriate. IMFLUSH calls
+ # one of the IMFLS? routines, which write out the section.
+
+ if (IM_FLUSH(imdes) == YES)
+ call zcall1 (IM_FLUSHEPA(imdes), imdes)
+
+ # Get an (output) buffer to put the pixels into. Save the
+ # section parameters in the image descriptor. Save the epa
+ # of the typed flush procedure in the image descriptor.
+
+ bp = imgobf (imdes, vs, ve, ndim, TY_COMPLEX)
+ call zlocpr (imflsx, IM_FLUSHEPA(imdes))
+ IM_FLUSH(imdes) = YES
+
+ return (bp)
+end
diff --git a/sys/imio/tf/impl1d.x b/sys/imio/tf/impl1d.x
new file mode 100644
index 00000000..227d25dd
--- /dev/null
+++ b/sys/imio/tf/impl1d.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPL1? -- Put a line to an apparently one dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl1d (im)
+
+pointer im # image header pointer
+int fd, nchars
+long offset
+pointer bp, impgsd(), fwritep()
+errchk imopsf
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_DOUBLE) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ offset = IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_DOUBLE
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_DOUBLE + 1)
+ return (bp)
+ }
+ return (impgsd (im, long(1), IM_LEN(im,1), 1))
+ }
+end
diff --git a/sys/imio/tf/impl1i.x b/sys/imio/tf/impl1i.x
new file mode 100644
index 00000000..a81d6b73
--- /dev/null
+++ b/sys/imio/tf/impl1i.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPL1? -- Put a line to an apparently one dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl1i (im)
+
+pointer im # image header pointer
+int fd, nchars
+long offset
+pointer bp, impgsi(), fwritep()
+errchk imopsf
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_INT) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ offset = IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_INT
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_INT + 1)
+ return (bp)
+ }
+ return (impgsi (im, long(1), IM_LEN(im,1), 1))
+ }
+end
diff --git a/sys/imio/tf/impl1l.x b/sys/imio/tf/impl1l.x
new file mode 100644
index 00000000..8f9616ca
--- /dev/null
+++ b/sys/imio/tf/impl1l.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPL1? -- Put a line to an apparently one dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl1l (im)
+
+pointer im # image header pointer
+int fd, nchars
+long offset
+pointer bp, impgsl(), fwritep()
+errchk imopsf
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_LONG) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ offset = IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_LONG
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_LONG + 1)
+ return (bp)
+ }
+ return (impgsl (im, long(1), IM_LEN(im,1), 1))
+ }
+end
diff --git a/sys/imio/tf/impl1r.x b/sys/imio/tf/impl1r.x
new file mode 100644
index 00000000..dc0ed92e
--- /dev/null
+++ b/sys/imio/tf/impl1r.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPL1? -- Put a line to an apparently one dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl1r (im)
+
+pointer im # image header pointer
+int fd, nchars
+long offset
+pointer bp, impgsr(), fwritep()
+errchk imopsf
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_REAL) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ offset = IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_REAL
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_REAL + 1)
+ return (bp)
+ }
+ return (impgsr (im, long(1), IM_LEN(im,1), 1))
+ }
+end
diff --git a/sys/imio/tf/impl1s.x b/sys/imio/tf/impl1s.x
new file mode 100644
index 00000000..a598e92a
--- /dev/null
+++ b/sys/imio/tf/impl1s.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPL1? -- Put a line to an apparently one dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl1s (im)
+
+pointer im # image header pointer
+int fd, nchars
+long offset
+pointer bp, impgss(), fwritep()
+errchk imopsf
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_SHORT) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ offset = IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_SHORT
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_SHORT + 1)
+ return (bp)
+ }
+ return (impgss (im, long(1), IM_LEN(im,1), 1))
+ }
+end
diff --git a/sys/imio/tf/impl1x.x b/sys/imio/tf/impl1x.x
new file mode 100644
index 00000000..6b141a14
--- /dev/null
+++ b/sys/imio/tf/impl1x.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPL1? -- Put a line to an apparently one dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl1x (im)
+
+pointer im # image header pointer
+int fd, nchars
+long offset
+pointer bp, impgsx(), fwritep()
+errchk imopsf
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_COMPLEX) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ offset = IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_COMPLEX
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_COMPLEX + 1)
+ return (bp)
+ }
+ return (impgsx (im, long(1), IM_LEN(im,1), 1))
+ }
+end
diff --git a/sys/imio/tf/impl2d.x b/sys/imio/tf/impl2d.x
new file mode 100644
index 00000000..cd4a1b6e
--- /dev/null
+++ b/sys/imio/tf/impl2d.x
@@ -0,0 +1,47 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMPL2? -- Put a line to an apparently two dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl2d (im, linenum)
+
+pointer im # image header pointer
+int linenum # line to be written
+
+int fd, nchars
+long vs[2], ve[2], offset
+pointer bp, impgsd(), fwritep()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_DOUBLE) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (linenum < 1 || linenum > IM_LEN(im,2))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (linenum - 1) * IM_PHYSLEN(im,1) * SZ_DOUBLE +
+ IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_DOUBLE
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_DOUBLE + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = linenum
+ ve[2] = linenum
+
+ return (impgsd (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/impl2i.x b/sys/imio/tf/impl2i.x
new file mode 100644
index 00000000..9f13e4ef
--- /dev/null
+++ b/sys/imio/tf/impl2i.x
@@ -0,0 +1,47 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMPL2? -- Put a line to an apparently two dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl2i (im, linenum)
+
+pointer im # image header pointer
+int linenum # line to be written
+
+int fd, nchars
+long vs[2], ve[2], offset
+pointer bp, impgsi(), fwritep()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_INT) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (linenum < 1 || linenum > IM_LEN(im,2))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (linenum - 1) * IM_PHYSLEN(im,1) * SZ_INT +
+ IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_INT
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_INT + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = linenum
+ ve[2] = linenum
+
+ return (impgsi (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/impl2l.x b/sys/imio/tf/impl2l.x
new file mode 100644
index 00000000..c42d57cf
--- /dev/null
+++ b/sys/imio/tf/impl2l.x
@@ -0,0 +1,47 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMPL2? -- Put a line to an apparently two dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl2l (im, linenum)
+
+pointer im # image header pointer
+int linenum # line to be written
+
+int fd, nchars
+long vs[2], ve[2], offset
+pointer bp, impgsl(), fwritep()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_LONG) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (linenum < 1 || linenum > IM_LEN(im,2))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (linenum - 1) * IM_PHYSLEN(im,1) * SZ_LONG +
+ IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_LONG
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_LONG + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = linenum
+ ve[2] = linenum
+
+ return (impgsl (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/impl2r.x b/sys/imio/tf/impl2r.x
new file mode 100644
index 00000000..43e84370
--- /dev/null
+++ b/sys/imio/tf/impl2r.x
@@ -0,0 +1,47 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMPL2? -- Put a line to an apparently two dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl2r (im, linenum)
+
+pointer im # image header pointer
+int linenum # line to be written
+
+int fd, nchars
+long vs[2], ve[2], offset
+pointer bp, impgsr(), fwritep()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_REAL) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (linenum < 1 || linenum > IM_LEN(im,2))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (linenum - 1) * IM_PHYSLEN(im,1) * SZ_REAL +
+ IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_REAL
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_REAL + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = linenum
+ ve[2] = linenum
+
+ return (impgsr (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/impl2s.x b/sys/imio/tf/impl2s.x
new file mode 100644
index 00000000..41bc248f
--- /dev/null
+++ b/sys/imio/tf/impl2s.x
@@ -0,0 +1,47 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMPL2? -- Put a line to an apparently two dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl2s (im, linenum)
+
+pointer im # image header pointer
+int linenum # line to be written
+
+int fd, nchars
+long vs[2], ve[2], offset
+pointer bp, impgss(), fwritep()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_SHORT) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (linenum < 1 || linenum > IM_LEN(im,2))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (linenum - 1) * IM_PHYSLEN(im,1) * SZ_SHORT +
+ IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_SHORT
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_SHORT + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = linenum
+ ve[2] = linenum
+
+ return (impgss (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/impl2x.x b/sys/imio/tf/impl2x.x
new file mode 100644
index 00000000..f16e9725
--- /dev/null
+++ b/sys/imio/tf/impl2x.x
@@ -0,0 +1,47 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMPL2? -- Put a line to an apparently two dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl2x (im, linenum)
+
+pointer im # image header pointer
+int linenum # line to be written
+
+int fd, nchars
+long vs[2], ve[2], offset
+pointer bp, impgsx(), fwritep()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_COMPLEX) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (linenum < 1 || linenum > IM_LEN(im,2))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (linenum - 1) * IM_PHYSLEN(im,1) * SZ_COMPLEX +
+ IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_COMPLEX
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_COMPLEX + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = linenum
+ ve[2] = linenum
+
+ return (impgsx (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/impl3d.x b/sys/imio/tf/impl3d.x
new file mode 100644
index 00000000..405ef94e
--- /dev/null
+++ b/sys/imio/tf/impl3d.x
@@ -0,0 +1,51 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMPL3? -- Put a line to an apparently three dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl3d (im, line, band)
+
+pointer im # image header pointer
+int line # line number within band
+int band # band number
+
+int fd, nchars
+long vs[3], ve[3], offset
+pointer bp, impgsd(), fwritep()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_DOUBLE) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (line < 1 || line > IM_LEN(im,2) ||
+ band < 1 || band > IM_LEN(im,3))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (((band - 1) * IM_PHYSLEN(im,2) + line - 1) *
+ IM_PHYSLEN(im,1)) * SZ_DOUBLE + IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_DOUBLE
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_DOUBLE + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = line
+ ve[2] = line
+ vs[3] = band
+ ve[3] = band
+
+ return (impgsd (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/impl3i.x b/sys/imio/tf/impl3i.x
new file mode 100644
index 00000000..0e0d4cd1
--- /dev/null
+++ b/sys/imio/tf/impl3i.x
@@ -0,0 +1,51 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMPL3? -- Put a line to an apparently three dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl3i (im, line, band)
+
+pointer im # image header pointer
+int line # line number within band
+int band # band number
+
+int fd, nchars
+long vs[3], ve[3], offset
+pointer bp, impgsi(), fwritep()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_INT) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (line < 1 || line > IM_LEN(im,2) ||
+ band < 1 || band > IM_LEN(im,3))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (((band - 1) * IM_PHYSLEN(im,2) + line - 1) *
+ IM_PHYSLEN(im,1)) * SZ_INT + IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_INT
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_INT + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = line
+ ve[2] = line
+ vs[3] = band
+ ve[3] = band
+
+ return (impgsi (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/impl3l.x b/sys/imio/tf/impl3l.x
new file mode 100644
index 00000000..2471825a
--- /dev/null
+++ b/sys/imio/tf/impl3l.x
@@ -0,0 +1,51 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMPL3? -- Put a line to an apparently three dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl3l (im, line, band)
+
+pointer im # image header pointer
+int line # line number within band
+int band # band number
+
+int fd, nchars
+long vs[3], ve[3], offset
+pointer bp, impgsl(), fwritep()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_LONG) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (line < 1 || line > IM_LEN(im,2) ||
+ band < 1 || band > IM_LEN(im,3))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (((band - 1) * IM_PHYSLEN(im,2) + line - 1) *
+ IM_PHYSLEN(im,1)) * SZ_LONG + IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_LONG
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_LONG + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = line
+ ve[2] = line
+ vs[3] = band
+ ve[3] = band
+
+ return (impgsl (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/impl3r.x b/sys/imio/tf/impl3r.x
new file mode 100644
index 00000000..675fd8d0
--- /dev/null
+++ b/sys/imio/tf/impl3r.x
@@ -0,0 +1,51 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMPL3? -- Put a line to an apparently three dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl3r (im, line, band)
+
+pointer im # image header pointer
+int line # line number within band
+int band # band number
+
+int fd, nchars
+long vs[3], ve[3], offset
+pointer bp, impgsr(), fwritep()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_REAL) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (line < 1 || line > IM_LEN(im,2) ||
+ band < 1 || band > IM_LEN(im,3))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (((band - 1) * IM_PHYSLEN(im,2) + line - 1) *
+ IM_PHYSLEN(im,1)) * SZ_REAL + IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_REAL
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_REAL + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = line
+ ve[2] = line
+ vs[3] = band
+ ve[3] = band
+
+ return (impgsr (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/impl3s.x b/sys/imio/tf/impl3s.x
new file mode 100644
index 00000000..63da06e2
--- /dev/null
+++ b/sys/imio/tf/impl3s.x
@@ -0,0 +1,51 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMPL3? -- Put a line to an apparently three dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl3s (im, line, band)
+
+pointer im # image header pointer
+int line # line number within band
+int band # band number
+
+int fd, nchars
+long vs[3], ve[3], offset
+pointer bp, impgss(), fwritep()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_SHORT) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (line < 1 || line > IM_LEN(im,2) ||
+ band < 1 || band > IM_LEN(im,3))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (((band - 1) * IM_PHYSLEN(im,2) + line - 1) *
+ IM_PHYSLEN(im,1)) * SZ_SHORT + IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_SHORT
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_SHORT + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = line
+ ve[2] = line
+ vs[3] = band
+ ve[3] = band
+
+ return (impgss (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/impl3x.x b/sys/imio/tf/impl3x.x
new file mode 100644
index 00000000..85b061cd
--- /dev/null
+++ b/sys/imio/tf/impl3x.x
@@ -0,0 +1,51 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <imhdr.h>
+include <imio.h>
+
+# IMPL3? -- Put a line to an apparently three dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl3x (im, line, band)
+
+pointer im # image header pointer
+int line # line number within band
+int band # band number
+
+int fd, nchars
+long vs[3], ve[3], offset
+pointer bp, impgsx(), fwritep()
+errchk imopsf, imerr
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_COMPLEX) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ if (line < 1 || line > IM_LEN(im,2) ||
+ band < 1 || band > IM_LEN(im,3))
+ call imerr (IM_NAME(im), SYS_IMREFOOB)
+
+ offset = (((band - 1) * IM_PHYSLEN(im,2) + line - 1) *
+ IM_PHYSLEN(im,1)) * SZ_COMPLEX + IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_COMPLEX
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_COMPLEX + 1)
+ return (bp)
+ }
+
+ vs[1] = 1
+ ve[1] = IM_LEN(im,1)
+ vs[2] = line
+ ve[2] = line
+ vs[3] = band
+ ve[3] = band
+
+ return (impgsx (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/impnld.x b/sys/imio/tf/impnld.x
new file mode 100644
index 00000000..b0f9bfd5
--- /dev/null
+++ b/sys/imio/tf/impnld.x
@@ -0,0 +1,31 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPNL -- Put the next line to an image of any dimension or datatype.
+# This is a sequential operator. The index vector V should be initialized
+# before the first call to the first line to be written. Each call increments
+# the leftmost subscript by one, until V equals IM_LEN, at which time EOF
+# is returned. Subsequent writes are ignored.
+
+int procedure impnld (imdes, lineptr, v)
+
+pointer imdes
+pointer lineptr # on output, points to the pixels
+long v[IM_MAXDIM] # loop counter
+int npix
+int impnln()
+extern imflsd()
+errchk impnln
+
+begin
+ if (IM_FLUSH(imdes) == YES)
+ call zcall1 (IM_FLUSHEPA(imdes), imdes)
+
+ npix = impnln (imdes, lineptr, v, TY_DOUBLE)
+ if (IM_FLUSH(imdes) == YES)
+ call zlocpr (imflsd, IM_FLUSHEPA(imdes))
+
+ return (npix)
+end
diff --git a/sys/imio/tf/impnli.x b/sys/imio/tf/impnli.x
new file mode 100644
index 00000000..6155a6b6
--- /dev/null
+++ b/sys/imio/tf/impnli.x
@@ -0,0 +1,31 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPNL -- Put the next line to an image of any dimension or datatype.
+# This is a sequential operator. The index vector V should be initialized
+# before the first call to the first line to be written. Each call increments
+# the leftmost subscript by one, until V equals IM_LEN, at which time EOF
+# is returned. Subsequent writes are ignored.
+
+int procedure impnli (imdes, lineptr, v)
+
+pointer imdes
+pointer lineptr # on output, points to the pixels
+long v[IM_MAXDIM] # loop counter
+int npix
+int impnln()
+extern imflsi()
+errchk impnln
+
+begin
+ if (IM_FLUSH(imdes) == YES)
+ call zcall1 (IM_FLUSHEPA(imdes), imdes)
+
+ npix = impnln (imdes, lineptr, v, TY_INT)
+ if (IM_FLUSH(imdes) == YES)
+ call zlocpr (imflsi, IM_FLUSHEPA(imdes))
+
+ return (npix)
+end
diff --git a/sys/imio/tf/impnll.x b/sys/imio/tf/impnll.x
new file mode 100644
index 00000000..3fb29144
--- /dev/null
+++ b/sys/imio/tf/impnll.x
@@ -0,0 +1,31 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPNL -- Put the next line to an image of any dimension or datatype.
+# This is a sequential operator. The index vector V should be initialized
+# before the first call to the first line to be written. Each call increments
+# the leftmost subscript by one, until V equals IM_LEN, at which time EOF
+# is returned. Subsequent writes are ignored.
+
+int procedure impnll (imdes, lineptr, v)
+
+pointer imdes
+pointer lineptr # on output, points to the pixels
+long v[IM_MAXDIM] # loop counter
+int npix
+int impnln()
+extern imflsl()
+errchk impnln
+
+begin
+ if (IM_FLUSH(imdes) == YES)
+ call zcall1 (IM_FLUSHEPA(imdes), imdes)
+
+ npix = impnln (imdes, lineptr, v, TY_LONG)
+ if (IM_FLUSH(imdes) == YES)
+ call zlocpr (imflsl, IM_FLUSHEPA(imdes))
+
+ return (npix)
+end
diff --git a/sys/imio/tf/impnlr.x b/sys/imio/tf/impnlr.x
new file mode 100644
index 00000000..c60c8631
--- /dev/null
+++ b/sys/imio/tf/impnlr.x
@@ -0,0 +1,31 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPNL -- Put the next line to an image of any dimension or datatype.
+# This is a sequential operator. The index vector V should be initialized
+# before the first call to the first line to be written. Each call increments
+# the leftmost subscript by one, until V equals IM_LEN, at which time EOF
+# is returned. Subsequent writes are ignored.
+
+int procedure impnlr (imdes, lineptr, v)
+
+pointer imdes
+pointer lineptr # on output, points to the pixels
+long v[IM_MAXDIM] # loop counter
+int npix
+int impnln()
+extern imflsr()
+errchk impnln
+
+begin
+ if (IM_FLUSH(imdes) == YES)
+ call zcall1 (IM_FLUSHEPA(imdes), imdes)
+
+ npix = impnln (imdes, lineptr, v, TY_REAL)
+ if (IM_FLUSH(imdes) == YES)
+ call zlocpr (imflsr, IM_FLUSHEPA(imdes))
+
+ return (npix)
+end
diff --git a/sys/imio/tf/impnls.x b/sys/imio/tf/impnls.x
new file mode 100644
index 00000000..af85bf8a
--- /dev/null
+++ b/sys/imio/tf/impnls.x
@@ -0,0 +1,31 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPNL -- Put the next line to an image of any dimension or datatype.
+# This is a sequential operator. The index vector V should be initialized
+# before the first call to the first line to be written. Each call increments
+# the leftmost subscript by one, until V equals IM_LEN, at which time EOF
+# is returned. Subsequent writes are ignored.
+
+int procedure impnls (imdes, lineptr, v)
+
+pointer imdes
+pointer lineptr # on output, points to the pixels
+long v[IM_MAXDIM] # loop counter
+int npix
+int impnln()
+extern imflss()
+errchk impnln
+
+begin
+ if (IM_FLUSH(imdes) == YES)
+ call zcall1 (IM_FLUSHEPA(imdes), imdes)
+
+ npix = impnln (imdes, lineptr, v, TY_SHORT)
+ if (IM_FLUSH(imdes) == YES)
+ call zlocpr (imflss, IM_FLUSHEPA(imdes))
+
+ return (npix)
+end
diff --git a/sys/imio/tf/impnlx.x b/sys/imio/tf/impnlx.x
new file mode 100644
index 00000000..e76cf1f1
--- /dev/null
+++ b/sys/imio/tf/impnlx.x
@@ -0,0 +1,31 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPNL -- Put the next line to an image of any dimension or datatype.
+# This is a sequential operator. The index vector V should be initialized
+# before the first call to the first line to be written. Each call increments
+# the leftmost subscript by one, until V equals IM_LEN, at which time EOF
+# is returned. Subsequent writes are ignored.
+
+int procedure impnlx (imdes, lineptr, v)
+
+pointer imdes
+pointer lineptr # on output, points to the pixels
+long v[IM_MAXDIM] # loop counter
+int npix
+int impnln()
+extern imflsx()
+errchk impnln
+
+begin
+ if (IM_FLUSH(imdes) == YES)
+ call zcall1 (IM_FLUSHEPA(imdes), imdes)
+
+ npix = impnln (imdes, lineptr, v, TY_COMPLEX)
+ if (IM_FLUSH(imdes) == YES)
+ call zlocpr (imflsx, IM_FLUSHEPA(imdes))
+
+ return (npix)
+end
diff --git a/sys/imio/tf/imps1d.x b/sys/imio/tf/imps1d.x
new file mode 100644
index 00000000..c8dd82b1
--- /dev/null
+++ b/sys/imio/tf/imps1d.x
@@ -0,0 +1,20 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS1? -- Put a section to an apparently one dimensional image.
+
+pointer procedure imps1d (im, x1, x2)
+
+pointer im # image header pointer
+int x1 # first column
+int x2 # last column
+
+pointer impgsd(), impl1d()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1))
+ return (impl1d (im))
+ else
+ return (impgsd (im, long(x1), long(x2), 1))
+end
diff --git a/sys/imio/tf/imps1i.x b/sys/imio/tf/imps1i.x
new file mode 100644
index 00000000..cb97a374
--- /dev/null
+++ b/sys/imio/tf/imps1i.x
@@ -0,0 +1,20 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS1? -- Put a section to an apparently one dimensional image.
+
+pointer procedure imps1i (im, x1, x2)
+
+pointer im # image header pointer
+int x1 # first column
+int x2 # last column
+
+pointer impgsi(), impl1i()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1))
+ return (impl1i (im))
+ else
+ return (impgsi (im, long(x1), long(x2), 1))
+end
diff --git a/sys/imio/tf/imps1l.x b/sys/imio/tf/imps1l.x
new file mode 100644
index 00000000..c8f5aae4
--- /dev/null
+++ b/sys/imio/tf/imps1l.x
@@ -0,0 +1,20 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS1? -- Put a section to an apparently one dimensional image.
+
+pointer procedure imps1l (im, x1, x2)
+
+pointer im # image header pointer
+int x1 # first column
+int x2 # last column
+
+pointer impgsl(), impl1l()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1))
+ return (impl1l (im))
+ else
+ return (impgsl (im, long(x1), long(x2), 1))
+end
diff --git a/sys/imio/tf/imps1r.x b/sys/imio/tf/imps1r.x
new file mode 100644
index 00000000..1bd1434c
--- /dev/null
+++ b/sys/imio/tf/imps1r.x
@@ -0,0 +1,20 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS1? -- Put a section to an apparently one dimensional image.
+
+pointer procedure imps1r (im, x1, x2)
+
+pointer im # image header pointer
+int x1 # first column
+int x2 # last column
+
+pointer impgsr(), impl1r()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1))
+ return (impl1r (im))
+ else
+ return (impgsr (im, long(x1), long(x2), 1))
+end
diff --git a/sys/imio/tf/imps1s.x b/sys/imio/tf/imps1s.x
new file mode 100644
index 00000000..130e7f18
--- /dev/null
+++ b/sys/imio/tf/imps1s.x
@@ -0,0 +1,20 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS1? -- Put a section to an apparently one dimensional image.
+
+pointer procedure imps1s (im, x1, x2)
+
+pointer im # image header pointer
+int x1 # first column
+int x2 # last column
+
+pointer impgss(), impl1s()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1))
+ return (impl1s (im))
+ else
+ return (impgss (im, long(x1), long(x2), 1))
+end
diff --git a/sys/imio/tf/imps1x.x b/sys/imio/tf/imps1x.x
new file mode 100644
index 00000000..5a5c33a0
--- /dev/null
+++ b/sys/imio/tf/imps1x.x
@@ -0,0 +1,20 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS1? -- Put a section to an apparently one dimensional image.
+
+pointer procedure imps1x (im, x1, x2)
+
+pointer im # image header pointer
+int x1 # first column
+int x2 # last column
+
+pointer impgsx(), impl1x()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1))
+ return (impl1x (im))
+ else
+ return (impgsx (im, long(x1), long(x2), 1))
+end
diff --git a/sys/imio/tf/imps2d.x b/sys/imio/tf/imps2d.x
new file mode 100644
index 00000000..e3f36fd9
--- /dev/null
+++ b/sys/imio/tf/imps2d.x
@@ -0,0 +1,26 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS2? -- Put a section to an apparently two dimensional image.
+
+pointer procedure imps2d (im, x1, x2, y1, y2)
+
+pointer im
+int x1, x2, y1, y2
+long vs[2], ve[2]
+pointer impgsd(), impl2d()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2)
+ return (impl2d (im, y1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ return (impgsd (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imps2i.x b/sys/imio/tf/imps2i.x
new file mode 100644
index 00000000..57e3f36c
--- /dev/null
+++ b/sys/imio/tf/imps2i.x
@@ -0,0 +1,26 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS2? -- Put a section to an apparently two dimensional image.
+
+pointer procedure imps2i (im, x1, x2, y1, y2)
+
+pointer im
+int x1, x2, y1, y2
+long vs[2], ve[2]
+pointer impgsi(), impl2i()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2)
+ return (impl2i (im, y1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ return (impgsi (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imps2l.x b/sys/imio/tf/imps2l.x
new file mode 100644
index 00000000..2d7bc8b7
--- /dev/null
+++ b/sys/imio/tf/imps2l.x
@@ -0,0 +1,26 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS2? -- Put a section to an apparently two dimensional image.
+
+pointer procedure imps2l (im, x1, x2, y1, y2)
+
+pointer im
+int x1, x2, y1, y2
+long vs[2], ve[2]
+pointer impgsl(), impl2l()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2)
+ return (impl2l (im, y1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ return (impgsl (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imps2r.x b/sys/imio/tf/imps2r.x
new file mode 100644
index 00000000..ce8b2958
--- /dev/null
+++ b/sys/imio/tf/imps2r.x
@@ -0,0 +1,26 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS2? -- Put a section to an apparently two dimensional image.
+
+pointer procedure imps2r (im, x1, x2, y1, y2)
+
+pointer im
+int x1, x2, y1, y2
+long vs[2], ve[2]
+pointer impgsr(), impl2r()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2)
+ return (impl2r (im, y1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ return (impgsr (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imps2s.x b/sys/imio/tf/imps2s.x
new file mode 100644
index 00000000..c5993a61
--- /dev/null
+++ b/sys/imio/tf/imps2s.x
@@ -0,0 +1,26 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS2? -- Put a section to an apparently two dimensional image.
+
+pointer procedure imps2s (im, x1, x2, y1, y2)
+
+pointer im
+int x1, x2, y1, y2
+long vs[2], ve[2]
+pointer impgss(), impl2s()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2)
+ return (impl2s (im, y1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ return (impgss (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imps2x.x b/sys/imio/tf/imps2x.x
new file mode 100644
index 00000000..12db84a5
--- /dev/null
+++ b/sys/imio/tf/imps2x.x
@@ -0,0 +1,26 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS2? -- Put a section to an apparently two dimensional image.
+
+pointer procedure imps2x (im, x1, x2, y1, y2)
+
+pointer im
+int x1, x2, y1, y2
+long vs[2], ve[2]
+pointer impgsx(), impl2x()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2)
+ return (impl2x (im, y1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ return (impgsx (im, vs, ve, 2))
+ }
+end
diff --git a/sys/imio/tf/imps3d.x b/sys/imio/tf/imps3d.x
new file mode 100644
index 00000000..0cd67b5e
--- /dev/null
+++ b/sys/imio/tf/imps3d.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS3? -- Put a section to an apparently three dimensional image.
+
+pointer procedure imps3d (im, x1, x2, y1, y2, z1, z2)
+
+pointer im
+int x1, x2, y1, y2, z1, z2
+long vs[3], ve[3]
+pointer impgsd(), impl3d()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2 && z1 == z2)
+ return (impl3d (im, y1, z1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ vs[3] = z1
+ ve[3] = z2
+
+ return (impgsd (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imps3i.x b/sys/imio/tf/imps3i.x
new file mode 100644
index 00000000..9ec4a832
--- /dev/null
+++ b/sys/imio/tf/imps3i.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS3? -- Put a section to an apparently three dimensional image.
+
+pointer procedure imps3i (im, x1, x2, y1, y2, z1, z2)
+
+pointer im
+int x1, x2, y1, y2, z1, z2
+long vs[3], ve[3]
+pointer impgsi(), impl3i()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2 && z1 == z2)
+ return (impl3i (im, y1, z1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ vs[3] = z1
+ ve[3] = z2
+
+ return (impgsi (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imps3l.x b/sys/imio/tf/imps3l.x
new file mode 100644
index 00000000..a68b2de5
--- /dev/null
+++ b/sys/imio/tf/imps3l.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS3? -- Put a section to an apparently three dimensional image.
+
+pointer procedure imps3l (im, x1, x2, y1, y2, z1, z2)
+
+pointer im
+int x1, x2, y1, y2, z1, z2
+long vs[3], ve[3]
+pointer impgsl(), impl3l()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2 && z1 == z2)
+ return (impl3l (im, y1, z1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ vs[3] = z1
+ ve[3] = z2
+
+ return (impgsl (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imps3r.x b/sys/imio/tf/imps3r.x
new file mode 100644
index 00000000..4fcbecff
--- /dev/null
+++ b/sys/imio/tf/imps3r.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS3? -- Put a section to an apparently three dimensional image.
+
+pointer procedure imps3r (im, x1, x2, y1, y2, z1, z2)
+
+pointer im
+int x1, x2, y1, y2, z1, z2
+long vs[3], ve[3]
+pointer impgsr(), impl3r()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2 && z1 == z2)
+ return (impl3r (im, y1, z1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ vs[3] = z1
+ ve[3] = z2
+
+ return (impgsr (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imps3s.x b/sys/imio/tf/imps3s.x
new file mode 100644
index 00000000..3758b3b9
--- /dev/null
+++ b/sys/imio/tf/imps3s.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS3? -- Put a section to an apparently three dimensional image.
+
+pointer procedure imps3s (im, x1, x2, y1, y2, z1, z2)
+
+pointer im
+int x1, x2, y1, y2, z1, z2
+long vs[3], ve[3]
+pointer impgss(), impl3s()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2 && z1 == z2)
+ return (impl3s (im, y1, z1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ vs[3] = z1
+ ve[3] = z2
+
+ return (impgss (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imps3x.x b/sys/imio/tf/imps3x.x
new file mode 100644
index 00000000..7062a3c1
--- /dev/null
+++ b/sys/imio/tf/imps3x.x
@@ -0,0 +1,29 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+# IMPS3? -- Put a section to an apparently three dimensional image.
+
+pointer procedure imps3x (im, x1, x2, y1, y2, z1, z2)
+
+pointer im
+int x1, x2, y1, y2, z1, z2
+long vs[3], ve[3]
+pointer impgsx(), impl3x()
+
+begin
+ if (x1 == 1 && x2 == IM_LEN(im,1) && y1 == y2 && z1 == z2)
+ return (impl3x (im, y1, z1))
+ else {
+ vs[1] = x1
+ ve[1] = x2
+
+ vs[2] = y1
+ ve[2] = y2
+
+ vs[3] = z1
+ ve[3] = z2
+
+ return (impgsx (im, vs, ve, 3))
+ }
+end
diff --git a/sys/imio/tf/imupkd.x b/sys/imio/tf/imupkd.x
new file mode 100644
index 00000000..ffbbe81e
--- /dev/null
+++ b/sys/imio/tf/imupkd.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# IMUPK? -- Convert an array of pixels of datatype DTYPE into the datatype
+# specified by the IMUPK? suffix character.
+
+procedure imupkd (a, b, npix, dtype)
+
+double b[npix]
+int a[npix], npix, dtype
+
+pointer bp
+
+begin
+ switch (dtype) {
+ case TY_USHORT:
+ call achtud (a, b, npix)
+ case TY_SHORT:
+ call achtsd (a, b, npix)
+ case TY_INT:
+ call achtid (a, b, npix)
+ case TY_LONG:
+ call achtld (a, b, npix)
+ case TY_REAL:
+ call achtrd (a, b, npix)
+ case TY_DOUBLE:
+ call achtdd (a, b, npix)
+ case TY_COMPLEX:
+ call achtxd (a, b, npix)
+ default:
+ call error (1, "Unknown datatype in imagefile")
+ }
+end
+
+
diff --git a/sys/imio/tf/imupki.x b/sys/imio/tf/imupki.x
new file mode 100644
index 00000000..0703b22b
--- /dev/null
+++ b/sys/imio/tf/imupki.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# IMUPK? -- Convert an array of pixels of datatype DTYPE into the datatype
+# specified by the IMUPK? suffix character.
+
+procedure imupki (a, b, npix, dtype)
+
+int b[npix]
+int a[npix], npix, dtype
+
+pointer bp
+
+begin
+ switch (dtype) {
+ case TY_USHORT:
+ call achtui (a, b, npix)
+ case TY_SHORT:
+ call achtsi (a, b, npix)
+ case TY_INT:
+ call achtii (a, b, npix)
+ case TY_LONG:
+ call achtli (a, b, npix)
+ case TY_REAL:
+ call achtri (a, b, npix)
+ case TY_DOUBLE:
+ call achtdi (a, b, npix)
+ case TY_COMPLEX:
+ call achtxi (a, b, npix)
+ default:
+ call error (1, "Unknown datatype in imagefile")
+ }
+end
+
+
diff --git a/sys/imio/tf/imupkl.x b/sys/imio/tf/imupkl.x
new file mode 100644
index 00000000..1b144e29
--- /dev/null
+++ b/sys/imio/tf/imupkl.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# IMUPK? -- Convert an array of pixels of datatype DTYPE into the datatype
+# specified by the IMUPK? suffix character.
+
+procedure imupkl (a, b, npix, dtype)
+
+long b[npix]
+int a[npix], npix, dtype
+
+pointer bp
+
+begin
+ switch (dtype) {
+ case TY_USHORT:
+ call achtul (a, b, npix)
+ case TY_SHORT:
+ call achtsl (a, b, npix)
+ case TY_INT:
+ call achtil (a, b, npix)
+ case TY_LONG:
+ call achtll (a, b, npix)
+ case TY_REAL:
+ call achtrl (a, b, npix)
+ case TY_DOUBLE:
+ call achtdl (a, b, npix)
+ case TY_COMPLEX:
+ call achtxl (a, b, npix)
+ default:
+ call error (1, "Unknown datatype in imagefile")
+ }
+end
+
+
diff --git a/sys/imio/tf/imupkr.x b/sys/imio/tf/imupkr.x
new file mode 100644
index 00000000..0cfccefc
--- /dev/null
+++ b/sys/imio/tf/imupkr.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# IMUPK? -- Convert an array of pixels of datatype DTYPE into the datatype
+# specified by the IMUPK? suffix character.
+
+procedure imupkr (a, b, npix, dtype)
+
+real b[npix]
+int a[npix], npix, dtype
+
+pointer bp
+
+begin
+ switch (dtype) {
+ case TY_USHORT:
+ call achtur (a, b, npix)
+ case TY_SHORT:
+ call achtsr (a, b, npix)
+ case TY_INT:
+ call achtir (a, b, npix)
+ case TY_LONG:
+ call achtlr (a, b, npix)
+ case TY_REAL:
+ call achtrr (a, b, npix)
+ case TY_DOUBLE:
+ call achtdr (a, b, npix)
+ case TY_COMPLEX:
+ call achtxr (a, b, npix)
+ default:
+ call error (1, "Unknown datatype in imagefile")
+ }
+end
+
+
diff --git a/sys/imio/tf/imupks.x b/sys/imio/tf/imupks.x
new file mode 100644
index 00000000..93d0ad3f
--- /dev/null
+++ b/sys/imio/tf/imupks.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# IMUPK? -- Convert an array of pixels of datatype DTYPE into the datatype
+# specified by the IMUPK? suffix character.
+
+procedure imupks (a, b, npix, dtype)
+
+short b[npix]
+int a[npix], npix, dtype
+
+pointer bp
+
+begin
+ switch (dtype) {
+ case TY_USHORT:
+ call achtus (a, b, npix)
+ case TY_SHORT:
+ call achtss (a, b, npix)
+ case TY_INT:
+ call achtis (a, b, npix)
+ case TY_LONG:
+ call achtls (a, b, npix)
+ case TY_REAL:
+ call achtrs (a, b, npix)
+ case TY_DOUBLE:
+ call achtds (a, b, npix)
+ case TY_COMPLEX:
+ call achtxs (a, b, npix)
+ default:
+ call error (1, "Unknown datatype in imagefile")
+ }
+end
+
+
diff --git a/sys/imio/tf/imupkx.x b/sys/imio/tf/imupkx.x
new file mode 100644
index 00000000..916bb73b
--- /dev/null
+++ b/sys/imio/tf/imupkx.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# IMUPK? -- Convert an array of pixels of datatype DTYPE into the datatype
+# specified by the IMUPK? suffix character.
+
+procedure imupkx (a, b, npix, dtype)
+
+complex b[npix]
+int a[npix], npix, dtype
+
+pointer bp
+
+begin
+ switch (dtype) {
+ case TY_USHORT:
+ call achtux (a, b, npix)
+ case TY_SHORT:
+ call achtsx (a, b, npix)
+ case TY_INT:
+ call achtix (a, b, npix)
+ case TY_LONG:
+ call achtlx (a, b, npix)
+ case TY_REAL:
+ call achtrx (a, b, npix)
+ case TY_DOUBLE:
+ call achtdx (a, b, npix)
+ case TY_COMPLEX:
+ call achtxx (a, b, npix)
+ default:
+ call error (1, "Unknown datatype in imagefile")
+ }
+end
+
+
diff --git a/sys/imio/tf/mkpkg b/sys/imio/tf/mkpkg
new file mode 100644
index 00000000..a79ca832
--- /dev/null
+++ b/sys/imio/tf/mkpkg
@@ -0,0 +1,123 @@
+# Update the type specific (generically expanded) IMIO procedures.
+
+$checkout libex.a lib$
+$update libex.a
+$checkin libex.a lib$
+$exit
+
+libex.a:
+ imflsd.x <imhdr.h> <imio.h>
+ imflsi.x <imhdr.h> <imio.h>
+ imflsl.x <imhdr.h> <imio.h>
+ imflsr.x <imhdr.h> <imio.h>
+ imflss.x <imhdr.h> <imio.h>
+ imflsx.x <imhdr.h> <imio.h>
+ imggsd.x <imhdr.h>
+ imggsi.x <imhdr.h>
+ imggsl.x <imhdr.h>
+ imggsr.x <imhdr.h>
+ imggss.x <imhdr.h>
+ imggsx.x <imhdr.h>
+ imgl1d.x <imhdr.h> <imio.h>
+ imgl1i.x <imhdr.h> <imio.h>
+ imgl1l.x <imhdr.h> <imio.h>
+ imgl1r.x <imhdr.h> <imio.h>
+ imgl1s.x <imhdr.h> <imio.h>
+ imgl1x.x <imhdr.h> <imio.h>
+ imgl2d.x <imhdr.h> <imio.h>
+ imgl2i.x <imhdr.h> <imio.h>
+ imgl2l.x <imhdr.h> <imio.h>
+ imgl2r.x <imhdr.h> <imio.h>
+ imgl2s.x <imhdr.h> <imio.h>
+ imgl2x.x <imhdr.h> <imio.h>
+ imgl3d.x <imhdr.h> <imio.h>
+ imgl3i.x <imhdr.h> <imio.h>
+ imgl3l.x <imhdr.h> <imio.h>
+ imgl3r.x <imhdr.h> <imio.h>
+ imgl3s.x <imhdr.h> <imio.h>
+ imgl3x.x <imhdr.h> <imio.h>
+ imgnld.x <imhdr.h>
+ imgnli.x <imhdr.h>
+ imgnll.x <imhdr.h>
+ imgnlr.x <imhdr.h>
+ imgnls.x <imhdr.h>
+ imgnlx.x <imhdr.h>
+ imgs1d.x <imhdr.h>
+ imgs1i.x <imhdr.h>
+ imgs1l.x <imhdr.h>
+ imgs1r.x <imhdr.h>
+ imgs1s.x <imhdr.h>
+ imgs1x.x <imhdr.h>
+ imgs2d.x <imhdr.h>
+ imgs2i.x <imhdr.h>
+ imgs2l.x <imhdr.h>
+ imgs2r.x <imhdr.h>
+ imgs2s.x <imhdr.h>
+ imgs2x.x <imhdr.h>
+ imgs3d.x <imhdr.h>
+ imgs3i.x <imhdr.h>
+ imgs3l.x <imhdr.h>
+ imgs3r.x <imhdr.h>
+ imgs3s.x <imhdr.h>
+ imgs3x.x <imhdr.h>
+ impakd.x
+ impaki.x
+ impakl.x
+ impakr.x
+ impaks.x
+ impakx.x
+ impgsd.x <imhdr.h> <imio.h>
+ impgsi.x <imhdr.h> <imio.h>
+ impgsl.x <imhdr.h> <imio.h>
+ impgsr.x <imhdr.h> <imio.h>
+ impgss.x <imhdr.h> <imio.h>
+ impgsx.x <imhdr.h> <imio.h>
+ impl1d.x <imhdr.h> <imio.h>
+ impl1i.x <imhdr.h> <imio.h>
+ impl1l.x <imhdr.h> <imio.h>
+ impl1r.x <imhdr.h> <imio.h>
+ impl1s.x <imhdr.h> <imio.h>
+ impl1x.x <imhdr.h> <imio.h>
+ impl2d.x <imhdr.h> <imio.h>
+ impl2i.x <imhdr.h> <imio.h>
+ impl2l.x <imhdr.h> <imio.h>
+ impl2r.x <imhdr.h> <imio.h>
+ impl2s.x <imhdr.h> <imio.h>
+ impl2x.x <imhdr.h> <imio.h>
+ impl3d.x <imhdr.h> <imio.h>
+ impl3i.x <imhdr.h> <imio.h>
+ impl3l.x <imhdr.h> <imio.h>
+ impl3r.x <imhdr.h> <imio.h>
+ impl3s.x <imhdr.h> <imio.h>
+ impl3x.x <imhdr.h> <imio.h>
+ impnld.x <imhdr.h> <imio.h>
+ impnli.x <imhdr.h> <imio.h>
+ impnll.x <imhdr.h> <imio.h>
+ impnlr.x <imhdr.h> <imio.h>
+ impnls.x <imhdr.h> <imio.h>
+ impnlx.x <imhdr.h> <imio.h>
+ imps1d.x <imhdr.h>
+ imps1i.x <imhdr.h>
+ imps1l.x <imhdr.h>
+ imps1r.x <imhdr.h>
+ imps1s.x <imhdr.h>
+ imps1x.x <imhdr.h>
+ imps2d.x <imhdr.h>
+ imps2i.x <imhdr.h>
+ imps2l.x <imhdr.h>
+ imps2r.x <imhdr.h>
+ imps2s.x <imhdr.h>
+ imps2x.x <imhdr.h>
+ imps3d.x <imhdr.h>
+ imps3i.x <imhdr.h>
+ imps3l.x <imhdr.h>
+ imps3r.x <imhdr.h>
+ imps3s.x <imhdr.h>
+ imps3x.x <imhdr.h>
+ imupkd.x
+ imupki.x
+ imupkl.x
+ imupkr.x
+ imupks.x
+ imupkx.x
+ ;