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

Home » Public Forums » archive » Re: directing control after program interruption
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: directing control after program interruption [message #20153 is a reply to message #20151] Thu, 18 May 2000 00:00 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"D. Mattes" <dmattes@u.washington.edu> writes:

> hello IDL power users: i have a long minimization process running under
> IDL. i would like the user to be able to interrupt the process at any
> time. once the user interrupts by typing ctrl-c, i would like to direct
> program control to a different part of the routine. the only way i know
> to resume the program run is the .continue executive command, but that
> just continues on with the next statement, whereas i would like to branch
> to the end of the routine. is there a system variable that is set when a
> user interrupts program flow? or does this fall into exception handling?

I do not think IDL is capable of what you are asking. On the other
hand, you can check for another control character to use for a
termination criterium. The GET_KBRD() function will poll the keyboard
without pausing, so you can do this periodically (i.e., every
iteration). Unfortunately, it will consume the keyboard buffer
contents, but that's the price you pay.

Here is how I do it in MPFIT, which looks for control-G ( = ASCII 7):

k = get_kbrd(0)
if k EQ string(byte(7)) then begin
message, 'WARNING: minimization not complete', /info
print, 'Do you want to terminate this procedure? (y/n)', $
format='(A,$)'
k = ''
read, k
if strupcase(strmid(k,0,1)) EQ 'Y' then begin
message, 'WARNING: Procedure is terminating.', /info
mperr = -1
endif
endif

MPFIT is a least squares fitter available here:

http://cow.physics.wisc.edu/~craigm/idl/idl.html

Good luck!
Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Previous Topic: Re: SPAWNing IDL from IDL under UNIX
Next Topic: simple question about bytes

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

Current Time: Sun Oct 12 02:00:42 PDT 2025

Total time taken to generate the page: 0.16096 seconds