From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- sys/plio/pldbgout.x | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 sys/plio/pldbgout.x (limited to 'sys/plio/pldbgout.x') 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 -- cgit