comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: endless loops suck
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: endless loops suck [message #33827 is a reply to message #33823] Sun, 02 February 2003 19:18 Go to previous messageGo to previous message
Thomas Gutzler is currently offline  Thomas Gutzler
Messages: 44
Registered: November 2002
Member
good morning,

David Fanning wrote:
>
> So I admit, "infinite" WHILE loops *can* be interrupted, as long as
> they use BEGIN ... END statement blocks. Try this:
>
> PRO Test
> While 1 DO BEGIN
> Print, 'Test before you Post!'
> ENDWHILE
> END

I thought about this and figured out that I have a loop with begin
and end. It looks like that:

PRO SnakeInterp,xi,yi,dmax,dmin
; x,y are arrays of coordinates
; dmin, dmax are preferred min and max distance between coordinates
[...]
; WHILE (MAX(d) GT dmax) DO BEGIN ; this would be correct
WHILE (1) DO BEGIN ; this obviously loops to dead
idx0 = (d GT dmax)
=> z = SnakeIndex(idx0) ; debugger is here
p = INDGEN(N+1)+1
xi = InterPol([xi,xi[0]],p,z)
yi = InterPol([yi,yi[0]],p,z)
N = N_ELEMENTS(xi)
d = abs( [xi[1:N-1],xi[0]] - xi) + abs( [yi[1:N-1],yi[0]] - yi)
ENDWHILE
END

FUNCTION snakeindex, idx
; SNAKEINDEX Create index for adpative interpolating the snake
arr = idx
N = N_ELEMENTS(xi)
arr = (TRANSPOSE([[arr],[INTARR(N)+1]]))[0:2*N-2]
y = DOUBLE(WHERE([1,arr] EQ 1))/2+1
RETURN, y
END

I pressed "Step out", then CTRL+BREAK (10 times) then CTRL+c (another 10
times) then I made myself a tea and read some news. After half an hour
taskmanager was my friend again :(
I thought maybe the compiler needs a little bit of time to finish
currently running processes before it polls the keyboard again and breaks.

> On my Windows machine I can interrupt this program (after I've
> learned my lesson) by doing a CNTL-Break.

I could interrupt the Print, 'Test before you Post!' loop with this, yes.

Perhaps I just should pay more attention to my sourcecode.

Tom
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL, arrays, and memory
Next Topic: Expert information needed

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 03:01:45 PDT 2025

Total time taken to generate the page: 0.79871 seconds