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

Home » Public Forums » archive » Re: how to determine current position in a program??
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: how to determine current position in a program?? [message #58135] Tue, 22 January 2008 10:04
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
On Tue, 22 Jan 2008, Mark wrote:

> Hello.
>
> I was wondering if anyone would offhand have any idea of how to go
> about determining which line number a program is at at a certain time.
> That is to say, I would like a program to print a message something
> like "at line 1234", where 1234 is the actual line number in the code.
>
> For example, I'd originally have:
>
> pro junk,xxx
> print,'1'
> print,'2'
> print,'you are now at this line in the code ',3
> return
> end
>
> Of course, I'd want to modify the code endless times to get something
> like:
>
>
> pro junk,xxx
> print,'1'
> print,'2'
> x=0. ;line 3
> x=x+1. ;line 4
> print,'you are now at this line in the code ',some_function()
> return
> end
>
> That is to say, I'd like have some_function() return the number 5,
> since it's being called at line 5 in the code. I don't want to
> constantly have to be changing my print statements, in other words.
>
> When programs crash you get an output to the effect that things came
> to a halt at such and such a line in one unit or another, so it seems
> like IDL might have the capability of knowing which line of a code is
> being executed at any given time.... Does anyone know if this can be
> done without too much pain and anguish......
>
> Thanks all,
>
> Mark
>

function some_function
traceback=scope_traceback(/struct)
return, traceback[n_elements(traceback)-2].line
end


regards,
lajos
[Message index]
 
Read Message
Previous Topic: how to determine current position in a program??
Next Topic: Re: interface between IDL and Matlab

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

Current Time: Sat Oct 11 08:17:25 PDT 2025

Total time taken to generate the page: 1.27827 seconds