! THE GENPLOTTING MODULE ! ! new Thu Apr 23 01:13.37 PM UTC 2026 ! module genplotting implicit none real :: xmin, xmax, ymin, ymax private :: xmin, xmax, ymin, ymax real :: xoffset, yoffset, xscale, yscale private :: xoffset, yoffset, xscale, yscale integer :: outunit private :: outunit contains ! --------------------------------------------------------- subroutine genp_init (foo, fname) integer, intent(in) :: foo character (len=*), intent(in) :: fname if (FOO .NE. 0) THEN WRITE(0, '("FOO .NE. 0")') CALL EXIT(1) END IF outunit = 6 ! stdout if (len(fname) .gt. 0) then write (0, '("genplot init opening : ", A)') fname open(newunit=outunit,file=fname) endif xmin = 9e9 ; xmax = -9e9 ymin = 9e9 ; ymax = -9e9 xoffset = 0.0 ; yoffset = 0.0 xscale = 0.0 ; yscale = 0.0 end subroutine ! --------------------------------------------------------- subroutine genp_set_offset(ox, oy) real, intent(in) :: ox, oy xoffset = ox ; yoffset = oy end subroutine subroutine genp_get_offset(ox, oy) real, intent(out) :: ox, oy ox = xoffset ; oy = yoffset end subroutine ! --------------------------------------------------------- subroutine genp_move (px, py) real, intent(in) :: px, py real :: lx, ly lx = px + xoffset ; ly = py + yoffset write (outunit, '(2F12.5, I5)') lx, ly, -1 if (lx .lt. xmin) xmin = lx if (lx .gt. xmax) xmax = lx if (ly .lt. ymin) ymin = ly if (ly .gt. ymax) ymax = ly end subroutine ! --------------------------------------------------------- subroutine genp_draw (px, py, color) real, intent(in) :: px, py integer, intent(in) :: color real :: lx, ly lx = px + xoffset ; ly = py + yoffset write (outunit, '(2F12.5, I5)') lx, ly, color if (lx .lt. xmin) xmin = lx if (lx .gt. xmax) xmax = lx if (ly .lt. ymin) ymin = ly if (ly .gt. ymax) ymax = ly end subroutine ! --------------------------------------------------------- subroutine genp_line(xa, ya, xb, yb, color) real, intent(in) :: xa, ya, xb, yb integer, intent(in) :: color call genp_move(xa, ya) call genp_draw(xb, yb, color) end subroutine ! --------------------------------------------------------- subroutine genp_end (foo) integer, intent(in) :: foo write (0, '("--- genp_end ---")') write (0, '("minmax X", 2F16.5)') xmin, xmax write (0, '("minmax Y", 2F16.5)') ymin, ymax write (outunit, '(2F16.5, I6)') xmin*1.05, ymin*1.05, -1 write (outunit, '(2F16.5, I6)') xmin*1.05, ymax*1.05, 0 write (outunit, '(2F16.5, I6)') xmax*1.05, ymax*1.05, 0 write (outunit, '(2F16.5, I6)') xmax*1.05, ymin*1.05, 0 write (outunit, '(2F16.5, I6)') xmin*1.05, ymin*1.05, 0 close (outunit) if (6 .ne. outunit) then write (0, '("genp_end on ", I6, " is ", I6)') outunit, foo endif end subroutine ! --------------------------------------------------------- ! --------------------------------------------------------- end module genplotting