[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to b
From: |
pjfarley3 |
Subject: |
Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be assigned to SYMTAB |
Date: |
Tue, 22 Oct 2019 11:19:56 -0400 |
OK, understood. Thanks for the advice.
Peter
> -----Original Message-----
> From: Andrew J. Schorr <address@hidden>
> Sent: Tuesday, October 22, 2019 8:45 AM
> To: address@hidden
> Cc: address@hidden; address@hidden
> Subject: Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable
names
> to be assigned to SYMTAB
>
> Hi Peter,
>
> You can certainly create your own fork of gawk and add a new extension
into
> the extensions subdirectory, but I suspect that Arnold would be very
unlikely to
> accept this change into the core distribution unless it was a vital
feature that
> was essential for typical gawk users.
> But it's his call as the maintainer...
>
> My sense is that the CSV extension has stalled, but I could be confused,
as I have
> not been monitoring it closely.
>
> The gawkextlib project provides a template for how to create a new
extension.
> The gawk distro does not, because it's not in the business of accepting
new
> extensions. :-)
>
> Regards,
> Andy
>
> On Mon, Oct 21, 2019 at 08:06:51PM -0400, pjfarley3 wrote
> > Hi Andy,
> >
> > I did look at the gawkextlib project code base for csv, but that seems
> > a bit beyond what I need on a more immediate basis. I like what I
> > saw, but for the moment I would like to try something simpler.
> >
> > (P.S. -- Is Manuel no longer working on that csv project? I remember
> > him from too many years ago when we both were active on the DJGPP
> > project.)
> >
> > Back to this subject. Is it possible to simply introduce a new C
> > source program into the gawk/extensions sub-directory and somehow just
> > use a make of gawk itself to find and compile and bind the new program
> > into the extensions library?
> >
> > I am assuming here that I will be able to craft a new C source from
> > the existing models in the gawk/extensions sub-directory fairly
> > quickly for the simple function(s) I envision at the moment.
> >
> > If so, what additional files besides the C source itself need to be
> > updated/created in the gawk/extensions sub-directory to allow this to
> > happen seamlessly? Also, how does one go about adding tests for new C
> > source function(s)?
> >
> > Apologies for my vast ignorance here, but I am trying to learn as I go
> > along.
> >
> > Peter
> >
> > > -----Original Message-----
> > > From: Andrew J. Schorr
> > > Sent: Monday, October 21, 2019 7:25 AM
> > > To: address@hidden
> > > Cc: address@hidden; address@hidden
> > > Subject: Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk
> > > variable
> > names
> > > to be assigned to SYMTAB
> > >
> > > Hi,
> > >
> > > A few points:
> > >
> > > 1. Tom's suggestion involves more typing than necessary. The example
> > below:
> > > FNR == 1 { for (i = 1; i <= NF; i++) mem[$i] = i }
> > > $(mem["Name"]) ~ /^H/ { process H.* records }
> > > $(mem("Amount"]) < 0 { process negative amount records }
> > >
> > > can be rewritten as (and I use this approach all the time):
> > > NR == 1 {
> > > for (i = 1; i <= NF; i++)
> > > m[$i] = i
> > > next
> > > }
> > >
> > > $m["Name"] ~ /^H/ { process H.* records }
> > > $m["Amount"] < 0 { process negative amount records }
> > >
> > > This saves 4 characters per variable reference (mem -> m, and no
> > > need for
> > the
> > > parentheses), so reduces the overhead by almost 50% (9 -> 5). :-)
> > >
> > > So yeah, it costs you a bit of typing, but it's so much cleaner than
> > mucking with
> > > SYMTAB.
> > >
> > > 2. If the goal here is really to process CSV files, then there's a
> > gawkextlib project
> > > to develop a CSV processing extension that could probably benefit
> > > from
> > some
> > > development/contributions.
> > >
> > > 3. If you develop your own extension, you are welcome to contribute
> > > it to
> > the
> > > gawkextlib project.
> > > http://gawkextlib.sourceforge.net/
> > > https://sourceforge.net/projects/gawkextlib/
> > >
> > > Regards,
> > > Andy
> > >
> > > On Mon, Oct 21, 2019 at 01:50:32AM -0400, pjfarley3 wrote
> > > > Apologies for forgetting to CC the list for the last two
> > > > iterations of this discussion. I am correcting that mistake with
this reply.
> > > >
> > > > Arnold,
> > > >
> > > > I understand your lack of enthusiasm, particularly after seeing
> > > > the unexpected and undesired results when I tried to actually use
> > > > my proposed update.
> > > >
> > > > After having reviewed the manual documentation of the gawk
> > > > extension API, I tend to agree that what I want to do is most
> > > > easily done in a new extension function.
> > > >
> > > > There do appear to be several of the delivered extension function
> > > > sources I could use as a model for a relatively simple extension
> > > > function that satisfies my use case.
> > > >
> > > > Thank you for your understanding, guidance, and genuine
> > > > consideration of my needs.
> > > >
> > > > If I get such an extension operating correctly and robustly, is
> > > > there any interest in my contributing that extension to the project?
> > > >
> > > > Regards,
> > > >
> > > > Peter
> > <Snipped>
> > > --
> > > Andrew Schorr
> > --
> >
>
> --
> Andrew Schorr
--
- Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be assigned to SYMTAB, (continued)
- Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be assigned to SYMTAB, arnold, 2019/10/08
- Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be assigned to SYMTAB, pjfarley3, 2019/10/08
- Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be assigned to SYMTAB, pjfarley3, 2019/10/13
- Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be assigned to SYMTAB, Tom Gray, 2019/10/14
- Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be assigned to SYMTAB, pjfarley3, 2019/10/15
- Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be assigned to SYMTAB, arnold, 2019/10/16
- Message not available
- Message not available
- Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be assigned to SYMTAB, pjfarley3, 2019/10/21
- Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be assigned to SYMTAB, Andrew J. Schorr, 2019/10/21
- Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be assigned to SYMTAB, pjfarley3, 2019/10/21
- Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be assigned to SYMTAB, Andrew J. Schorr, 2019/10/22
- Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be assigned to SYMTAB,
pjfarley3 <=
- Re: [bug-gawk] gawk 5.0.1 patch to allow *valid* awk variable names to be assigned to SYMTAB, arnold, 2019/10/22