bug-gawk
[Top][All Lists]
Advanced

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

[bug-gawk] built-in variables in extensions


From: Assaf Gordon
Subject: [bug-gawk] built-in variables in extensions
Date: Mon, 17 Dec 2012 15:45:23 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4

Hello Arnold,

Continuing my quest for header-line support in gawk...
Perhaps it's too complicated without internal code changes - in which case I'll 
drop it. WDYT?

Trying to write my own extension, I've encountered the following case:
If my extension tries to access a built-in variable that isn't used in the code 
(e.g. "NR" or "NF") - the value is not properly returned.

It may sound obvious, and probably related to the other SYMTAB issues, but it 
brings some inconsistencies:

An extension can use some of the built-in variables, but not all.
It's not clear (or documented) which ones are usable and which ones are not.
Example: "testext.c" uses ARGC, and "fork.c" uses PROCINFO - and they "just 
work".
But if one uses "NR" or "NF" - they will only work properly if NR or NF are 
referenced in the AWK program.

Which means an extension is not completely self-contained if it uses those 
variables - it will require the user (of the extension) to reference the 
variables at least once.

If this is the intended behavior, perhaps it's best to add some clarifications 
about "sym_lookup" and global variables.


Thanks,
 -gordon



reply via email to

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