> I guess i come from a completely different angle in terms off adding on features to awk - i made mine to be
>
> - all still at scripting level,
> - make close to zero amount of external calls (other than benchmarking
> utility - only mawk2 gives me sub-second timestamps, the rest i need
> to go to gnu-date)
cppawk is a shell script, and calls the preprocessor and awk; but you
can capture the preprocessor output and then you just have an awk script
you can pass to awk; basically you can use it like a "compiler" to
produce a single "executable" out of one or more files and/or command
line program.
That would be a use case when preparing something for an embedded
system, where you might not want the preprocessor, or if you
don't want the preprocessing overhead each time you run some
frequently run program.
> - same code base being able to all run from at least 4 variants of awk
> that i have (so it can't leverage any of the extra goodies from gawk,
> and i have to devise equivalent ones),
I not only have that, but you in cppawk you can test which Awk you're
using at preprocessing time:
#if __gawk__
...
#else
...
#endif
can test using #if which Awk you're running on. There are command
line options to tell cppawk which Awk to generate code for and execute.
One big exception to portability is Gawk indirect functions which
group_by depends on. So group_by will not be available if you don't
have Gawk.
Take a look at <case.h>; it's provides a portable case statement syntax
that becomes switch if you have Gawk, or else portable code for other
Awks.
Indirect function stuff failing on mawk:
$ ./cppawk --awk=mawk '
#include <cons.h>
#include <array.h>
#include <fun.h>
{ push(cons($1, $2), lst) }
END { group_by(fun(car), lst, arr);
for (i in arr) print i, sexp(arr[i]) }'
In file included from ./cppawk-include/fun.h:32:0,
from <stdin>:4:
./cppawk-include/fun-priv.h:40:2: warning: #warning "<fun.h> requires an Awk with function indirection like newer GNU Awk" [-Wcpp]
#warning "<fun.h> requires an Awk with function indirection like newer GNU Awk"
^~~~~~~
mawk: /dev/fd/63: line 835: function group_by never defined
Things not requiring <fun.h> are good to go, though.