delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/09/12/00:00:27

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:subject:reply-to:to:references:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=O6/Y4uqD9fIYVLmr
kMk387+d6CdrWSOVF+6Kvt7CjfHITN9ObaTuUWJ7MPVHveT0iQCfTgg4ihCZlVb2
+y/RKJ/Iu771X9Ozp7kJhxHfKDjwbuDgajWqN6ZSPYRl5vWJ/QKjVqJ5MucHATAn
OdZO487ze9P/4hRYYaL6QJ52UrE=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:subject:reply-to:to:references:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=mHOAK5X1aTSmRhstyOoLCy
UeiPo=; b=poEup8qI8oOlsw2MunVG4tklh9M4uAVi/ZvCQ3lfTvAl6ZrBNoZafp
pXhLZFrLo0Q57h2xODiLOtu7LMDZmj8L8vnVXGF3Bb6Xe8GJa0L1OSiBwwPJGZjb
Q3/ha8loSD1t/OqJlm0d/WquR+2p66QR+OkhD0Ex92GtqRwgzkbKk=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=penny, Penny, Works
X-HELO: smtp-out-so.shaw.ca
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Subject: Re: Where is igawk and why doesn't @include replicate this feature?
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
To: cygwin AT cygwin DOT com
References: <CAC9BAENxZs7ZwSHz1Xq0DAxP0tS6R4fUQ6Rv_tEG_qrCsOZTew AT mail DOT gmail DOT com> <5d78dfe7 DOT 1c69fb81 DOT 686f1 DOT 9f87 AT mx DOT google DOT com>
Openpgp: preference=signencrypt
Message-ID: <db22e440-9406-797c-e493-fc94f8f3ca51@SystematicSw.ab.ca>
Date: Wed, 11 Sep 2019 21:59:13 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0
MIME-Version: 1.0
In-Reply-To: <5d78dfe7.1c69fb81.686f1.9f87@mx.google.com>
X-IsSubscribed: yes
Note-from-DJ: This may be spam

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019