aboutsummaryrefslogtreecommitdiff
path: root/sys/plio/plascii.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/plio/plascii.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/plio/plascii.x')
-rw-r--r--sys/plio/plascii.x66
1 files changed, 66 insertions, 0 deletions
diff --git a/sys/plio/plascii.x b/sys/plio/plascii.x
new file mode 100644
index 00000000..8106b10e
--- /dev/null
+++ b/sys/plio/plascii.x
@@ -0,0 +1,66 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <ctype.h>
+include <plset.h>
+
+# PL_ASCIIDUMP -- Dump a two dimensional region of a mask as a printable ASCII
+# character array on the output stream. Intended as a simple debugging tool;
+# see also PL_SAVEIM.
+
+procedure pl_asciidump (pl, vs, ve, outfd)
+
+pointer pl #I mask descriptor
+long vs[ARB] #I ll vector (only first two elements used)
+long ve[ARB] #I ur vector (only first two elements used)
+int outfd #I output file
+
+pointer sp, pv, cv
+int npix, ch, i
+long v[PL_MAXDIM]
+errchk pl_valid
+
+begin
+ call pl_valid (pl)
+ npix = ve[1] - vs[1] + 1
+
+ call smark (sp)
+ call salloc (pv, npix, TY_INT)
+ call salloc (cv, npix, TY_CHAR)
+
+ # Output mask.
+ call amovl (vs, v, PL_MAXDIM)
+ v[2] = ve[2]
+
+ while (v[2] >= vs[2]) {
+ call pl_glpi (pl, v, Memi[pv], 0, npix, PIX_SRC)
+ do i = 1, npix {
+ ch = mod (Memi[pv+i-1], 128)
+ if (ch < 32)
+ ch = ch + 32
+ if (ch <= 32 || ch == 127)
+ ch = '.'
+ Memc[cv+i-1] = ch
+ }
+ call fprintf (outfd, "%3d ")
+ call pargi (v[2])
+ call write (outfd, Memc[cv], npix)
+ call putci (outfd, '\n')
+ v[2] = v[2] - 1
+ }
+
+ # Label the columns.
+ call fprintf (outfd, "%5t")
+ do i = 1, npix
+ call putci (outfd, TO_DIGIT(mod (i,10)))
+ call fprintf (outfd, "\n")
+
+ call fprintf (outfd, "%5t")
+ do i = 1, npix
+ if (mod (i, 10) == 0)
+ call putci (outfd, TO_DIGIT(i / 10))
+ else
+ call putci (outfd, ' ')
+ call fprintf (outfd, "\n")
+
+ call sfree (sp)
+end