[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] built-in variables in extensions
From: |
Assaf Gordon |
Subject: |
Re: [bug-gawk] built-in variables in extensions |
Date: |
Mon, 17 Dec 2012 17:16:57 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4 |
Andrew J. Schorr wrote, On 12/17/2012 04:41 PM:
> On Mon, Dec 17, 2012 at 04:38:06PM -0500, Assaf Gordon wrote:
>
> 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?
>
That's exactly what I'm working on now (which is how I discovered an extension
can't access "NF" and "NR" if they are not defined in the AWK source.
Combining an AWK include and a C extension is a nice idea. Will keep you posted
on progress.
-gordon
- [bug-gawk] built-in variables in extensions, Assaf Gordon, 2012/12/17
- Re: [bug-gawk] built-in variables in extensions, Andrew J. Schorr, 2012/12/17
- Re: [bug-gawk] built-in variables in extensions, Assaf Gordon, 2012/12/17
- Re: [bug-gawk] built-in variables in extensions, Andrew J. Schorr, 2012/12/17
- Re: [bug-gawk] built-in variables in extensions, Assaf Gordon, 2012/12/17
- Re: [bug-gawk] built-in variables in extensions, Andrew J. Schorr, 2012/12/17
- Re: [bug-gawk] built-in variables in extensions,
Assaf Gordon <=
- Re: [bug-gawk] parsing column title header records, Andrew J. Schorr, 2012/12/17
- Re: [bug-gawk] parsing column title header records, Assaf Gordon, 2012/12/17
- Re: [bug-gawk] bug in gawkapi.c:sym_update_real, Andrew J. Schorr, 2012/12/17
- Re: [bug-gawk] bug in gawkapi.c:sym_update_real, Assaf Gordon, 2012/12/17
- Re: [bug-gawk] bug in gawkapi.c:sym_update_real, Andrew J. Schorr, 2012/12/17
- Re: [bug-gawk] sym_constant not working properly, Andrew J. Schorr, 2012/12/17
- Re: [bug-gawk] sym_constant not working properly, Aharon Robbins, 2012/12/18
- Re: [bug-gawk] bug in gawkapi.c:sym_update_real, Assaf Gordon, 2012/12/18
- Re: [bug-gawk] bug in gawkapi.c:sym_update_real, Andrew J. Schorr, 2012/12/18
- Re: [bug-gawk] bug in gawkapi.c:sym_update_real, Aharon Robbins, 2012/12/18