Commit ca6539b6 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

fixed infinite loop for long last filename

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 5162
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 5b8bda17
......@@ -41,7 +41,7 @@ c
integer traceinfile(maxtraces)
integer firstinchain
integer firstinrevchain
character*160 filename(maxfiles)
character*120 filename(maxfiles)
character*20 source(maxfiles)
character*5 station(maxtraces)
character*3 channel(maxtraces)
......
......@@ -25,6 +25,8 @@ c
c REVISIONS and CHANGES
c 03/07/98 V1.0 Thomas Forbriger
c 13/11/2012 V1.1 do positioning by full trial and error
c 30/04/2013 V1.2 the algorithm resulted in an infinite loop, if
c the last filename would not fit into one line
c
c==============================================================================
c
......@@ -43,7 +45,7 @@ c
real scalfac
integer scalstep, scalmaxstep, nline
logical gotit
parameter (purexsep=0.1, pureysep=0.02, scalmaxstep=30)
parameter (purexsep=0.1, pureysep=0.02, scalmaxstep=60)
c
c set viewport
call pgsave
......@@ -73,19 +75,23 @@ c go
xpos=xpos+maxheight
i=1
do while (i.le.nfiles)
c place filename label at next available position and test bounding box
pg_nam_xpos(i)=xpos
pg_nam_ypos(i)=ypos
call pgqtxt(xpos, ypos, 90., 0., filename(i), xbox, ybox)
pg_nam_yend(i)=ybox(4)
if (pg_nam_yend(i).gt.0.9) then
if (pg_nam_yend(i).gt.1.0) then
c label exceeds upper bound
c create a carriage return and line-feed
ypos=0.
nline=nline+1
xpos=maxheight+xpos+xsep
if (xpos.gt.1.) then
gotit=.false.
i=nfiles
i=nfiles+1
endif
else
c label fits, shift to next position
ypos=pg_nam_yend(i)+ysep
i=i+1
endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment