Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Getting source file and line number of a function.



"Rocky Bernstein" wrote:
> I see that zsh has now has array variables functrace and
> funcstack. Functrace stack gives a function name and a line offset
> from the function. But for many things involving location reporting,
> it would more be desirable to have a filename and absolute line
> location.
> 
> Alternatively, if there were a way to get the filename and line number
> of the beginning of a given function, one can do some arithmetic to
> get the absolute position.
> 
> Is there currently a way to get this information. Should I try at
> submitting a patch?

It would be useful to have information referred to the autoload file,
and I've wondered about how to do it, but I don't think it's trivial
with the current way line numbers work.  We would probably need to add
an extra internal variable for file line numbers, and present another
variable (or array, if in the funcstack style) to users to distinguish
the two.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



Messages sorted by: Reverse Date, Date, Thread, Author