aboutsummaryrefslogtreecommitdiff
path: root/sys/plio/pllpr.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/pllpr.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/plio/pllpr.x')
-rw-r--r--sys/plio/pllpr.x111
1 files changed, 111 insertions, 0 deletions
diff --git a/sys/plio/pllpr.x b/sys/plio/pllpr.x
new file mode 100644
index 00000000..9a8d1684
--- /dev/null
+++ b/sys/plio/pllpr.x
@@ -0,0 +1,111 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <plio.h>
+
+# PLL_PRINTS -- Print a line list on the given output stream.
+
+procedure pll_prints (ll, fd, label, firstcol, maxcols)
+
+short ll[ARB] #I line list
+int fd #I output file
+char label[ARB] #I line label
+int firstcol #I first column for output
+int maxcols #I width of formatted output
+
+pointer sp, buf
+bool skipword
+int opcode, data
+int ll_len, ll_first, col, ip, pv, x
+int strlen()
+
+begin
+ call smark (sp)
+ call salloc (buf, SZ_FNAME, TY_CHAR)
+
+ # Support old format line lists.
+ if (LL_OLDFORMAT(ll)) {
+ ll_len = OLL_LEN(ll)
+ ll_first = OLL_FIRST
+ } else {
+ ll_len = LL_LEN(ll)
+ ll_first = LL_FIRST(ll)
+ }
+
+ # Output the line label and advance to the first column. If the label
+ # extends beyond the first column, start a new line.
+
+ call putline (fd, label)
+ col = strlen (label) + 1
+ if (col > firstcol)
+ call pl_debugout (fd, "", col, firstcol, maxcols)
+
+ skipword = false
+ pv = 1
+ x = 1
+
+ # Decode the line list proper.
+ do ip = ll_first, ll_len {
+ if (skipword) {
+ skipword = false
+ next
+ }
+
+ opcode = I_OPCODE(ll[ip])
+ data = I_DATA(ll[ip])
+
+ switch (opcode) {
+ case I_ZN:
+ x = x + data
+ call sprintf (Memc[buf], SZ_FNAME, "Z%d")
+ call pargi (data)
+ case I_HN:
+ x = x + data
+ call sprintf (Memc[buf], SZ_FNAME, "H%d")
+ call pargi (data)
+ case I_PN:
+ x = x + data
+ call sprintf (Memc[buf], SZ_FNAME, "P%d")
+ call pargi (data)
+
+ case I_SH:
+ pv = (int(ll[ip+1]) * I_SHIFT) + data
+ skipword = true
+ call sprintf (Memc[buf], SZ_FNAME, "SH(%d)")
+ call pargi (pv)
+ case I_IH:
+ pv = pv + data
+ call sprintf (Memc[buf], SZ_FNAME, "IH%d(%d)")
+ call pargi (data)
+ call pargi (pv)
+ case I_DH:
+ pv = pv - data
+ call sprintf (Memc[buf], SZ_FNAME, "DH%d(%d)")
+ call pargi (data)
+ call pargi (pv)
+
+ case I_IS, I_DS:
+ x = x + 1
+ if (opcode == I_IS) {
+ pv = pv + data
+ call sprintf (Memc[buf], SZ_FNAME, "IS%d(%d)")
+ call pargi (data)
+ call pargi (pv)
+ } else {
+ pv = pv - data
+ call sprintf (Memc[buf], SZ_FNAME, "DS%d(%d)")
+ call pargi (data)
+ call pargi (pv)
+ }
+ }
+
+ call pl_debugout (fd, Memc[buf], col, firstcol, maxcols)
+ }
+
+ call sprintf (Memc[buf], SZ_FNAME, "(%d,%d)")
+ call pargi (x - 1)
+ call pargi (pv)
+ call pl_debugout (fd, Memc[buf], col, firstcol, maxcols)
+
+ call pl_debugout (fd, "", col, firstcol, maxcols)
+ call sfree (sp)
+end