]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Propagate pre-processor directives from enum definition to strings definition
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 4 Apr 2011 12:57:49 +0000 (00:57 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 4 Apr 2011 12:57:49 +0000 (00:57 +1200)
This allows enum to contain conditional entries and build without them.

src/mk-string-arrays.awk

index 42133a3f5cecd1089c4c41a4b43e67966a6996e6..be0ebadf3a3458ef1cf2ae168eaa7f7cf6cdbcc0 100644 (file)
@@ -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