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/psio/psbreak.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/psio/psbreak.x')
-rw-r--r-- | sys/psio/psbreak.x | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/sys/psio/psbreak.x b/sys/psio/psbreak.x new file mode 100644 index 00000000..eb82b541 --- /dev/null +++ b/sys/psio/psbreak.x @@ -0,0 +1,80 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <psset.h> +include "psio.h" + + +# PS_LINEBREAK -- Break the current line regardless of whether it has been +# filled. The fill_flag says whether to fill the current line to be right +# justified. May be called to simply output the current line buffer. + +procedure ps_linebreak (ps, fill_flag) + +pointer ps #I PSIO descriptor +int fill_flag #I fill line flag + +begin + iferr (call ps_output (ps, Memc[PS_WBPTR(ps)], fill_flag)) + return + + # Do a variable spacing depending on whether we're within unformatted + # text where the font is smaller, or outputting a regular line. + + if (PS_CFONT(ps) == F_TELETYPE) + PS_YPOS(ps) = PS_YPOS(ps) - ((LINE_HEIGHT-2) * RESOLUTION) + else + PS_YPOS(ps) = PS_YPOS(ps) - (LINE_HEIGHT * RESOLUTION) + + # Check for a page break. + if (PS_YPOS(ps) <= PS_PBMARGIN(ps)) + call ps_pagebreak (ps) + else { + call fprintf (PS_FD(ps), "%d V\n") + call pargi (PS_YPOS(ps)) + } + + # Reset the X position to current left margin. + PS_XPOS(ps) = PS_CLMARGIN(ps) + + # Clear the word buffer. + call aclrc (Memc[PS_WBPTR(ps)], SZ_LINE) +end + + +# PS_NEWLINE -- Output a newline (vertical space actually). + +procedure ps_newline (ps) + +pointer ps #I PSIO descriptor + +begin + # Check for a page break. + PS_YPOS(ps) = PS_YPOS(ps) - ((LINE_HEIGHT-4) * RESOLUTION) + if (PS_YPOS(ps) <= PS_PBMARGIN(ps)) + call ps_pagebreak (ps) + else { + call fprintf (PS_FD(ps), "%d V\n") + call pargi (PS_YPOS(ps)) + } + + # Reset the X position to current left margin. + PS_XPOS(ps) = PS_CLMARGIN(ps) +end + + +# PS_PAGEBREAK -- Break the current page regardless of whether it has been +# filled. + +procedure ps_pagebreak (ps) + +pointer ps #I PSIO descriptor + +begin + PS_PNUM(ps) = PS_PNUM(ps) + 1 + call fprintf (PS_FD(ps), "EP\n%%%%Page: %d %d\nBP\n") + call pargi (PS_PNUM(ps)) + call pargi (PS_PNUM(ps)) + + PS_YPOS(ps) = (PS_PHEIGHT(ps) * RESOLUTION) - PS_PTMARGIN(ps) + call ps_ypos (ps, PS_YPOS(ps)) +end |