aboutsummaryrefslogtreecommitdiff
path: root/sys/imio/tf/impl3l.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /sys/imio/tf/impl3l.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/imio/tf/impl3l.x')
-rw-r--r--sys/imio/tf/impl3l.x51
1 files changed, 51 insertions, 0 deletions
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