| Re: how to rerun subroutine only? [message #42722 is a reply to message #42721] |
Mon, 21 February 2005 13:32   |
kashyap
Messages: 26 Registered: April 1993
|
Junior Member |
|
|
In article <1109014029.766542.64110@g14g2000cwa.googlegroups.com>,
<u2s5thmember@yahoo.com> wrote:
> this is probably a beginner question, so I appreciate your patience:
>
> Suppose I compile & run a top level program, then it enters a
> subroutine. Then suppose I want the code to stop somewhere in the
> subroutine so I can plot variables or check on/plot the results of a
> calculation... or say the subroutine encounters an error. then I might
> change something in the subroutine and need to rerun the subroutine.
>
> right now I recompile the subroutine then rerun the entire code
> starting from the beginning of the toplevel program, when all I really
> need to do is have idl redo the calculations from the beginning of the
> subroutine.
>
> is there a way to do this?
>
> thanks in advance for your time!
Depends..
There is no way to move flow control to the beginning of the
program (that I know of), but if simple debugging is all you
want to do, then yes.
First get out of the subroutine with a ".out" or a "return" or
a "return,-1", then recompile that subroutine (if it is in a
separate file; this won't work if subroutine is in the same file
as the main program), and simply call it with the same calling
sequence as you did in the main program. Make sure you feed it
the right variables in the parameters, because they may have
changed in value or property in the interim.
Vinay
--
____________________________________________________________ __________________
kashyap@head.cfa.harvard.edu 617 495 7173 [CfA/P-145] 617 496 7173 [F]
|
|
|
|