aboutsummaryrefslogtreecommitdiff
path: root/sys/plio/pldbgout.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/pldbgout.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/plio/pldbgout.x')
-rw-r--r--sys/plio/pldbgout.x47
1 files changed, 47 insertions, 0 deletions
diff --git a/sys/plio/pldbgout.x b/sys/plio/pldbgout.x
new file mode 100644
index 00000000..26885f3e
--- /dev/null
+++ b/sys/plio/pldbgout.x
@@ -0,0 +1,47 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# PL_DEBUGOUT -- Output formatter for PL package debug output. Output as
+# many text items as will fit on a line, inserting one space between each
+# text item. A call with BUF=EOS terminates the sequence with a newline.
+
+procedure pl_debugout (fd, buf, col, firstcol, maxcol)
+
+int fd #I output stream
+char buf[ARB] #I text to be output
+int col #I next column of output
+int firstcol #I first column to write to
+int maxcol #I last column to write to
+
+int nchars
+int strlen()
+
+begin
+ nchars = min (maxcol-firstcol+1, strlen(buf))
+
+ if (nchars == 0) {
+ # Terminate the sequence with a newline.
+ call fprintf (fd, "\n")
+ col = 1
+ return
+
+ } else if (col + nchars > maxcol) {
+ # Break line and output token.
+ call fprintf (fd, "\n")
+
+ for (col=1; col < firstcol; col=col+1)
+ call putci (fd, ' ')
+
+ } else {
+ # Append to the current line.
+ if (col <= firstcol) {
+ for (; col < firstcol; col=col+1)
+ call putci (fd, ' ')
+ } else {
+ call putci (fd, ' ')
+ col = col + 1
+ }
+ }
+
+ call putline (fd, buf)
+ col = col + nchars
+end