bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Tentative CSV extension - please advise


From: arnold
Subject: Re: [bug-gawk] Tentative CSV extension - please advise
Date: Tue, 15 Mar 2016 02:18:21 -0600
User-agent: Heirloom mailx 12.4 7/29/08

> > 1.- The extension should provide CSV field values as $1-$NF
>
> That sounds right.
>
> > 2.- The current extension api only allows to provide a string value for $0,
> > but not individual field values. $0 is split into fields by the gawk core
> > according to the current FS.
>
> I took a look at the awk_input_buf_t API, and you are right. And it has to be
> this way, since the file could also be read using getline into a variable, in
> which case the notion of $1-$NF does not apply.

The right way to do this is to extend the extension mechanism with a function
pointer that sets the fields.  Or more likely to add a fields array pointer
to the awk_input_buf_t and a flag indicating that the values should be used.
Careful attention needs to be paid to memory management in this case.

HTH,

Arnold



reply via email to

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