/usr/share/gerris/m4.awk is in gerris 20131206+dfsg-18.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | function replace_params(s, b, i)
{
for (i in b)
gsub(b[i], "($" i ")", s);
return s;
}
BEGIN {
print prefix "changecom()" prefix "dnl";
}
{
if ($1 == "GfsDefine" || $1 == "Define") {
macro = $2;
split("", b); # delete b
# if we could use gawk, we could do ...
# if (match(macro, /(.+)\((.+)\)/, a)) {
# macro = a[1];
# split(a[2],b,",");
# }
# but for portability we need to do ...
if (match(macro, /.+\(/)) {
a[1] = substr(macro, RSTART, RLENGTH - 1);
last = substr(macro, RSTART + RLENGTH);
if (match(last, /.+\)/)) {
a[2] = substr(last, RSTART, RLENGTH - 1);
macro = a[1];
split(a[2],b,",");
}
}
printf (prefix "define(`%s',`%s", macro, replace_params($3, b));
for (i = 4; i <= NF; i++)
printf (" %s", replace_params($i, b));
printf ("')\n");
}
else if ($1 == "GfsInclude" || $1 == "Include")
printf (prefix "include(%s)\n", $2);
else
print $0;
}
|