diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /sys/imio/tf/impl2i.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/imio/tf/impl2i.x')
-rw-r--r-- | sys/imio/tf/impl2i.x | 47 |
1 files changed, 47 insertions, 0 deletions
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 |