1C*PGSWIN -- set window
2C%void cpgswin(float x1, float x2, float y1, float y2);
3C+
4      SUBROUTINE PGSWIN (X1, X2, Y1, Y2)
5      REAL X1, X2, Y1, Y2
6C
7C Change the window in world coordinate space that is to be mapped on
8C to the viewport.  Usually PGSWIN is called automatically by PGENV,
9C but it may be called directly by the user.
10C
11C Arguments:
12C  X1     (input)  : the x-coordinate of the bottom left corner
13C                    of the viewport.
14C  X2     (input)  : the x-coordinate of the top right corner
15C                    of the viewport (note X2 may be less than X1).
16C  Y1     (input)  : the y-coordinate of the bottom left corner
17C                    of the viewport.
18C  Y2     (input)  : the y-coordinate of the top right corner
19C                    of the viewport (note Y2 may be less than Y1).
20C--
21C 15-Nov-95: check arguments to prevent divide-by-zero [TJP].
22C-----------------------------------------------------------------------
23      INCLUDE 'pgplot.inc'
24      LOGICAL PGNOTO
25C
26      IF (PGNOTO('PGSWIN')) RETURN
27C
28C If invalid arguments are specified, issue warning and leave window
29C unchanged.
30C
31      IF (X1.EQ.X2) THEN
32         CALL GRWARN('invalid x limits in PGSWIN: X1 = X2.')
33      ELSE IF (Y1.EQ.Y2) THEN
34         CALL GRWARN('invalid y limits in PGSWIN: Y1 = Y2.')
35      ELSE
36         PGXBLC(PGID) = X1
37         PGXTRC(PGID) = X2
38         PGYBLC(PGID) = Y1
39         PGYTRC(PGID) = Y2
40         CALL PGVW
41      END IF
42      END
43