Re: noop? [message #53290] |
Fri, 06 April 2007 09:58  |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On Apr 6, 11:55 am, Christopher Thom <c...@oddjob.uchicago.edu> wrote:
> Quoth hradilv:
>
>> On Apr 6, 11:37 am, Christopher Thom <c...@oddjob.uchicago.edu> wrote:
>>> Hi all,
>
>>> Does IDL have some kind of noop statement? I'm looking for something to
>>> anchor breakpoints at a point where several control statments have their
>>> ends...
>
>>> cheers
>>> chris
>
>> Philosophical thoughts aside...
>
>> How about:
>
>> ; NOOP
>
> Ahhh...humour...and it works! :) I just wanted something to anchor a
> breakpoint in my code...the snippet looks like:
>
> endelse
> endfor
> endfor
>
> and IDL didn't want to put a breakpoint on those. A "stop" command would
> serve equally well...but I tend to forget to take them out, and then set
> my code running, come back an hour later to check...and ooops :-)
>
> cheers
> chris
I see. Usually I insert a "print" statement, then I get really ugly
output when I forget to remove them.
|
|
|
|
|
|
|
Re: noop? [message #53431 is a reply to message #53291] |
Fri, 13 April 2007 06:28  |
Ingo von Borstel
Messages: 54 Registered: September 2006
|
Member |
|
|
Hi,
>>>
>>> Does IDL have some kind of noop statement? I'm looking for something to
>>> anchor breakpoints at a point where several control statments have their
>>> ends...
I sometimes have the same problem. I wrote myself a tiny function
"is_debug" and add a debug keyword to the functions I'm testing. My code
then reads somewhat like this:
PRO procedure_to_be_tested, param1, param2, debug=debug
this_debugvalue = 8
if not keyword_set(debug) then debug=0
for i=0,10000 do begin
for j=0,10000 do begin
for k=0,10000 do begin
do something
endfor
endfor
if is_debug(this_debugvalue,debug) then stop
endfor
FUNCTION is_debug, debug, value
RETURN, (debug AND value) eq value
END
If you set this_debugvalue to the n-th power of 2, you have a check
whether the n-th bit is set within the debug variable. Then, if the n-th
bit of debug is set, your procedure will stop. It will run normally
without stop, if you don't call it with the debug keyword.
I'm pretty sure there's a more elegant solution, but it works for me;
Best regards,
Ingo
--
Ingo von Borstel <newsgroups@planetmaker.de>
Public Key: http://www.planetmaker.de/ingo.asc
If you need an urgent reply, replace newsgroups by vgap.
|
|
|