Skip to content

Commit f478952

Browse files
committed
formatted print
1 parent 74d09cc commit f478952

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

app/main.f90

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,22 @@ program donut
1818
real(wp) :: sini,cosj,sinA,sinj,cosA,cosj2, mess, cosi,cosB,t,sinB
1919
integer :: x,y,o,N,ii, u, Nloop
2020
character(5) :: buf
21+
2122
character(:), allocatable :: dumpfn
23+
logical :: dump
2224

23-
Nloop = 100
25+
Nloop = 300
26+
dump = .false.
2427
do ii = 1, command_argument_count()
2528
call get_command_argument(ii, buf)
2629

2730
select case (buf)
2831
case ("-dump")
2932
call get_command_argument(ii+1, buf, status=k)
30-
if (k==0) dumpfn = trim(buf)
33+
if (k==0) then
34+
dumpfn = trim(buf)
35+
dump = .true.
36+
endif
3137
case ("-frames")
3238
call get_command_argument(ii+1, buf, status=k)
3339
if (k==0) read(buf, '(I5)') Nloop
@@ -41,7 +47,7 @@ program donut
4147

4248
allocate(z(0:L-1), screen(0:L-1))
4349

44-
if(allocated(dumpfn)) open(newunit=u, file=dumpfn, status='replace', action='write')
50+
if(dump) open(newunit=u, file=dumpfn, status='replace', action='write')
4551

4652
write(stdout,"(a)", advance="no") ESC // "[2J" !< move cursor to top left
4753

@@ -79,16 +85,14 @@ program donut
7985
write(stdout, "(a)", advance="no") ESC // "[d" !< line feed
8086

8187
do k=0, rows-2
82-
print *, screen(k*cols:k*cols+cols)
83-
if(allocated(dumpfn)) write(u, "(80a)") screen(k*cols:k*cols+cols)
88+
print '(81a)', screen(k*cols:k*cols+cols)
89+
if(dump) write(u, "(81a)") screen(k*cols:k*cols+cols)
8490
enddo
8591

86-
! print *, size(screen), k*cols,k*cols+cols
87-
8892
a = a + 0.04
8993
b = b + 0.02
9094
enddo
9195

92-
if(allocated(dumpfn)) close(u)
96+
if(dump) close(u)
9397

9498
end program

0 commit comments

Comments
 (0)