aboutsummaryrefslogtreecommitdiff
path: root/sys/psio/psjustify.x
blob: 367cc6fe85b49873e2165dbb93395867a0b6e4b8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include "psio.h"


# PS_RIGHTJUSTIFY -- Right justfify text on the given string and break.

procedure ps_rightjustify (ps, str)

pointer ps                                      #I PSIO descriptor
char    str[ARB]                                #I text line

int     mtemp, ps_rjPos()
errchk	ps_output

begin
	mtemp = PS_CLMARGIN(ps)
        PS_CLMARGIN(ps) = ps_rjpos (ps, str)
	call ps_output (ps, str, NO)
	PS_CLMARGIN(ps) = mtemp
end


# PS_RJPOS -- Get the X position of the right-justified string.

int procedure ps_rjpos (ps, str)

pointer	ps					#I PSIO descriptor
char	str[ARB]				#I text to justify

int	ps_textwidth()
errchk	ps_textwidth

begin
	return (PS_CRMPOS(ps) - ps_textwidth (ps, str))
end


# PS_SET_JUSTIFY -- Set the justification flag.

procedure ps_setjustify (ps, justify)

pointer	ps					#I PSIO descriptor
int	justify					#I justificaton flag

begin
	PS_JUSTIFY(ps) = justify
end