GAWK?

15 views
Skip to first unread message

Ralf Hemmecke

unread,
Sep 8, 2020, 4:20:20 PM9/8/20
to fricas-devel
Waldek,

I usually install gawk on my machine, but on testing Debian 10 I didn't.
FriCAS configure ran fine with the default mawk, but failed at my ht.awk
script in the "formatted" branch.

mawk complained about the "next" in line 554.

https://github.com/hemmecke/fricas/blob/formatted/src/doc/ht.awk#L554

Before a try to look what is to be changed, can you confirm that FriCAS
should run fine with any awk?

The code in configure.ac
https://github.com/hemmecke/fricas/blob/formatted/configure.ac#L101
claims at least for solaris9 that gawk is needed.

Is FriCAS supposed to work with mawk? Can we require gawk in general or
would you rather like to be able to build with any awk?

If it is any awk, then what is the language that is accepted for FriCAS
awk scripts, since there are quite a few differences between the various
awks.

In that "any awk case", it would be helpful to know the reason why mawk says

make[3]: Entering directory '/home/hemmecke/scratch/fricas/src/doc'
mawk -f /home/hemmecke/g/fricas/src/doc/ht.awk
/home/hemmecke/g/fricas/src/doc/htex/ug02.htex tmp > ug02.ht
mawk: /home/hemmecke/g/fricas/src/doc/ht.awk: line 554: improper use of next
make[3]: *** [Makefile:477: ug02.ht] Error 2

Ralf

Ralf Hemmecke

unread,
Sep 8, 2020, 6:56:14 PM9/8/20
to fricas...@googlegroups.com
Hmmm... to answer my own problem... replacing "next" by "exit 1" seems
to solve the problem (i.e., runs with mawk just fine). It would anyway
be better not to ignore missing braces for \spad{...} commands.

Ralf

Waldek Hebisch

unread,
Sep 9, 2020, 6:54:25 AM9/9/20
to fricas...@googlegroups.com
On Tue, Sep 08, 2020 at 10:20:18PM +0200, Ralf Hemmecke wrote:
> Waldek,
>
> I usually install gawk on my machine, but on testing Debian 10 I didn't.
> FriCAS configure ran fine with the default mawk, but failed at my ht.awk
> script in the "formatted" branch.
>
> mawk complained about the "next" in line 554.
>
> https://github.com/hemmecke/fricas/blob/formatted/src/doc/ht.awk#L554
>
> Before a try to look what is to be changed, can you confirm that FriCAS
> should run fine with any awk?
>
> The code in configure.ac
> https://github.com/hemmecke/fricas/blob/formatted/configure.ac#L101
> claims at least for solaris9 that gawk is needed.

Yes, FriCAS should build with different awk, in particular mawk.
Solaris is somewhat special. Some "standard" Solaris tools
were/are extremaly old fashioned it make no sense to support
so old tools on rare platform. OTOH there were fixes to our
awk scripts and there is good chance that they will work now.
But it seems that nobody tried Solaris in many years so we keep
it without change.

> Is FriCAS supposed to work with mawk? Can we require gawk in general or
> would you rather like to be able to build with any awk?
>
> If it is any awk, then what is the language that is accepted for FriCAS
> awk scripts, since there are quite a few differences between the various
> awks.

There is Posix standard for awk so core language should be the
same on all reasonably modern awk. In practice we deal with
issues in reactive manner: it there is a problem we fix it.
Currenly mawk is main alternative...

IIRC manual for GNU awk said which parts are standard and
which are extentions.
>
> In that "any awk case", it would be helpful to know the reason why mawk says
>
> make[3]: Entering directory '/home/hemmecke/scratch/fricas/src/doc'
> mawk -f /home/hemmecke/g/fricas/src/doc/ht.awk
> /home/hemmecke/g/fricas/src/doc/htex/ug02.htex tmp > ug02.ht
> mawk: /home/hemmecke/g/fricas/src/doc/ht.awk: line 554: improper use of next
> make[3]: *** [Makefile:477: ug02.ht] Error 2

From mawk manual:

: Program flow at the pattern {action} level can be changed with the
:
: next
: exit opt_expr

so it seems that you are not allowed to use next in functions.
--
Waldek Hebisch

Ralf Hemmecke

unread,
Sep 9, 2020, 7:15:49 AM9/9/20
to fricas-devel
> Yes, FriCAS should build with different awk, in particular mawk.

OK.

> From mawk manual:
>
> : Program flow at the pattern {action} level can be changed with the
> :
> : next
> : exit opt_expr
>
> so it seems that you are not allowed to use next in functions.

Yes, that would also be my interpretation. However, clearly, one can
only interpret it this way if one runs into that error. Unfortunately,
then I don't understand, why mawk seemingly allows to replace my "next"
by "exit 1" and does the right thing without signalling "exit not
allowed in this position".

The description above is not very clear if one must run the program to
see how it behaves.

Ralf

Reply all
Reply to author
Forward
0 new messages