bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enhancement request for source line number variable.


From: Aharon Robbins
Subject: Re: Enhancement request for source line number variable.
Date: Sun, 13 Jan 2008 08:41:10 +0200

Greetings. Re this:

> Date: Sun, 06 Jan 2008 14:18:15 -0800
> From: Norman Abramovitz <address@hidden>
> Subject: Enhancement request for source line number variable.
> To: address@hidden
>
> It would be nice to be able to get the actual source line for program
> generated error messages.  It could be done with a preprocessor, but
> it would easier if gawk supported this ability directly like ksh does
> with the LINENO variable.  Now that gawk supports the procinfo array,
> maybe a subscript like lineno could be added.
>
> Norman Abramovitz

This is an interesting idea; thank you for the suggestion.

This isn't trivial to implement:

- Line numbers alone are not enough, since gawk can read multiple source
  files and multiple command line arguments. (What does ksh do with
  code executed from sourced files? I don't know.)

- I have to figure out exactly when and where the internal information
  that tracks source code and line number are maintained so that I know
  where to get it. (:-)

- PROCINFO["file"] and PROCINFO["line"] have to be made to work in a "pull"
  fashion. That is, the value of the source file name and/or line number are
  retrieved when requested, instead of set at every transition. Doing it the
  latter way is likely to have negative performance implications for very
  large input files.

I don't know how much demand there is for this feature.  If you (or someone
else) wishes to develop a patch to do this, I will review it and likely
include it.

In the meantime, I will think about this some, and see how hard it is for
me to do.

Thanks,

Arnold




reply via email to

[Prev in Thread] Current Thread [Next in Thread]