bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] built-in variables in extensions


From: Andrew J. Schorr
Subject: Re: [bug-gawk] built-in variables in extensions
Date: Mon, 17 Dec 2012 16:41:34 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Dec 17, 2012 at 04:38:06PM -0500, Assaf Gordon wrote:
> Almost! I thought so too :)
> 
> But to quote Arnold: "You can't do that":
> 
> http://lists.gnu.org/archive/html/bug-gawk/2012-12/msg00012.html

Yes, but what about my proposal at the bottom of my email:

On Mon, Dec 17, 2012 at 04:34:38PM -0500, Andrew J. Schorr wrote:
> But suppose this is not a stable feature.  Here is another approach:
> 
> bash-4.1$ cat /tmp/header.awk
> @load "create_variable"
> 
> NR == 1 {
>         for (i = 1; i <= NF; i++)
>                 create_variable($i, i)
>         next
> }
> 
> where "create_variable" is a shared library extension that exports the 
> function
> create_variable that creates a variable whose name is given in the first
> argument and value in the second.  I believe it should be pretty trivial to
> implement this extension using the current gawk api.  While neither an
> include file nor a shared library can do this without help, the combination
> should do it quite easily, unless I'm hallucinating.

Can you try that?

Regards,
Andy



reply via email to

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