Re: [NTG-context] How to Determine the Current File Name and Line Number in the ConTeXt Source?
Taco Hoekwater wrote:
Tad Ashlock wrote:
Looks like we're always getting the xstrdup() branch of the conditional.
Probably because you are not reading from a file at that level, but from a token list. Do you want filename to be a file even if the current input is not directly from a file at all (doable, but less meaningful)?
Best wishes, Taco
Hi Taco, I'm far from an expert in this realm, but since you asked what *I* want... :) My intention is to associate status.filename and status.linenumber together. That is, I would read and save their values consecutively in the same Lua function so that they would refer to the ConTeXt source line currently being processed by the ConTeXt engine. Now you say that ConTeXt may not be reading from a file at that level. That I can accept (being a non-expert), but status.linenumber always returns the correct line number for the ConTeXt file being processed (even if the file is being \input from another file). It seems to me that if the line number within the source file is accurate, then the file's name should be accurate, too. Thank you, Tad
Tad Ashlock wrote:
Now you say that ConTeXt may not be reading from a file at that level. That I can accept (being a non-expert), but status.linenumber always returns the correct line number for the ConTeXt file being processed (even if the file is being \input from another file). It seems to me that if the line number within the source file is accurate, then the file's name should be accurate, too.
I've patched status.filename so that it will behave like that starting with the next beta. Best wishes, Taco
participants (2)
-
Taco Hoekwater
-
Tad Ashlock