chiark / gitweb /
Warnings: generate: Basic `wrn' function
[secnet.git] / generate
index 4014471a43019cec4e683d1d3ab60e4b82e6edc8..9be1cfb8bf4b5d9f6ceabb91bd1174724cf8a69b 100755 (executable)
--- a/generate
+++ b/generate
@@ -176,6 +176,11 @@ sub err ($) {
     die "subdirmk: ${err_file}:$.: $m\n";
 }
 
+sub wrn ($) {
+    my ($m) = @_;
+    print STDERR "subdirmk: warning: ${err_file}:$.: $m\n";
+}
+
 sub ddbl_only ($) {
     my ($e) = @_;
     return if $ddbl;
@@ -216,6 +221,7 @@ sub process_input_mk ($$$$) {
 
     local $ddbl;
     my @nest = (['']);
+    my $evalcall_brackets;
 
     my $push_nest = sub {
        my ($nk, $nndbl, $what) = @_;
@@ -255,12 +261,14 @@ sub process_input_mk ($$$$) {
                    : s{^(.*?)($esc)}{}) { od $_; last; }
            od $1;
            if ($2 eq '{') {
-               $ddbl++;
+               od $2;
+               $evalcall_brackets++;
                next;
            } elsif ($2 eq '}') {
-               next if --$ddbl;
+               od $2;
+               next if --$evalcall_brackets;
                $pop_nest->('eval');
-               od '}}';
+               od '}';
                next;
            }
            if (s{^\\$esc}{}) { od "$$esclitr" }
@@ -282,6 +290,7 @@ sub process_input_mk ($$$$) {
            elsif (s{^\$\{}{}) {
                err 'macro invocation cannot be re-$-doubled' if $ddbl;
                od '${eval ${call ';
+               $evalcall_brackets = 1;
                $push_nest->('eval',1, '&${...}');
            } elsif (s{^([~^]?)(?=[ \t])}{}) {
                my $prefix = $pfxmap{$1} // die "internal error ($1?)";