From: Amos Jeffries Date: Mon, 4 Apr 2011 12:57:49 +0000 (+1200) Subject: Propagate pre-processor directives from enum definition to strings definition X-Git-Tag: take06~27^2~37 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0d03fdb825a62b9bc62dc625297f56add787f309;p=thirdparty%2Fsquid.git Propagate pre-processor directives from enum definition to strings definition This allows enum to contain conditional entries and build without them. --- diff --git a/src/mk-string-arrays.awk b/src/mk-string-arrays.awk index 42133a3f5c..be0ebadf3a 100644 --- a/src/mk-string-arrays.awk +++ b/src/mk-string-arrays.awk @@ -37,6 +37,13 @@ codeSkip == 1 { next } next } +/^#/ { + if (codeSkip) next + + Wrapper[++e] = $0 + next +} + /^} / { split($2, t, ";") # remove ; type = t[1] @@ -50,7 +57,9 @@ codeSkip == 1 { next } print "\nconst char *" type "_str[] = {" for ( i = 1; i < e; ++i) - print "\t\"" Element[i] "\"," + if (Wrapper[i]) print Wrapper[i] + else print "\t\"" Element[i] "\"," + print "\t\"" Element[i] "\"" print "};" if (namespace) print "}; // namespace " namespace