From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin@cygwin.com
Subject: Re: Where is igawk and why doesn't @include replicate this feature?
Date: Thu, 12 Sep 2019 05:18:00 -0000 [thread overview]
Message-ID: <db22e440-9406-797c-e493-fc94f8f3ca51@SystematicSw.ab.ca> (raw)
In-Reply-To: <5d78dfe7.1c69fb81.686f1.9f87@mx.google.com>
On 2019-09-11 05:52, Steven Penny wrote:
> On Wed, 11 Sep 2019 16:54:49, Troy Kenah wrote:
>> I used to embed @include junk.awk statements to reduce repetitive code but
>> this no longer works. These were files were not functions, simply code
>> snippets; this is the type of error I am now seeing:
> Works fine here:
>
> Â Â $ gawk --version
> Â Â GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.1.2)
>
> Â Â $ cat one.awk
> Â Â function f1(n1) {
> Â Â Â Â Â return n1 + 10
> Â Â }
>
> Â Â $ cat two.awk
> Â Â @include "one.awk"
> Â Â BEGIN {
> Â Â Â Â Â print f1(20)
> Â Â }
>
> Â Â $ unset POSIXLY_CORRECT
> Â Â $ gawk -f two.awk
> Â Â 30
>
> Finally, I would make a suggestion. "@include" is not POSIX, so if you find
> yourself relying on something like this more and more, it might be better to
> switch to a proper programming language. Something like Perl, Lua or Tcl.
Any number of files are supported with option -f repetition as are expressions
with option -e repetition in any order.
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
next prev parent reply other threads:[~2019-09-12 3:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-11 11:52 Troy Kenah
2019-09-11 14:27 ` Steven Penny
2019-09-12 5:18 ` Brian Inglis [this message]
2019-09-11 18:10 ` Achim Gratz
2019-09-12 3:00 ` Kaz Kylheku
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=db22e440-9406-797c-e493-fc94f8f3ca51@SystematicSw.ab.ca \
--to=brian.inglis@systematicsw.ab.ca \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).