aboutsummaryrefslogtreecommitdiff
path: root/sys/psio/pscenter.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/psio/pscenter.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/psio/pscenter.x')
-rw-r--r--sys/psio/pscenter.x36
1 files changed, 36 insertions, 0 deletions
diff --git a/sys/psio/pscenter.x b/sys/psio/pscenter.x
new file mode 100644
index 00000000..818c33cb
--- /dev/null
+++ b/sys/psio/pscenter.x
@@ -0,0 +1,36 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include "psio.h"
+
+
+# PS_CENTER -- Center the string on the page and break.
+
+procedure ps_center (ps, str)
+
+pointer ps #I PSIO descriptor
+char str[ARB] #I text string
+
+int mtemp, ps_centerPos()
+errchk ps_centerpos, ps_output
+
+begin
+ mtemp = PS_CLMARGIN(ps)
+ PS_CLMARGIN(ps) = ps_centerpos (ps, str)
+ call ps_output (ps, str, NO)
+ PS_CLMARGIN(ps) = mtemp
+end
+
+
+# PS_CENTERPOS -- Get the X position of the centered string.
+
+int procedure ps_centerpos (ps, str)
+
+pointer ps #I PSIO descriptor
+char str[ARB] #I string to center
+
+int ps_textwidth()
+errchk ps_textwidth
+
+begin
+ return (((PS_PWIDTH(ps) * RESOLUTION)/2) - ps_textwidth (ps, str) / 2)
+end