]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Update mk-string-arrays.awk to support c++-style enums
authorFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 5 Sep 2015 11:27:59 +0000 (13:27 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 5 Sep 2015 11:27:59 +0000 (13:27 +0200)
src/mk-string-arrays.awk

index a1f331ae0c5d87db9ca4a303ada71b8feccc1bac..840badd0970b200f0d8a513d617b4ed78cf5c7f3 100644 (file)
@@ -34,6 +34,16 @@ BEGIN {
 
 # Skip all lines outside of typedef {}
 /^typedef/             { codeSkip = 0; next }
+/^enum class / {
+  codeSkip = 0
+  type = $3
+  next;
+}
+/^enum / {
+  codeSkip = 0
+  type = $2
+  next;
+}
 codeSkip == 1          { next }
 
 /^[ \t]*[A-Z]/ {
@@ -50,11 +60,19 @@ codeSkip == 1               { next }
        next
 }
 
+/};/ {
+  codeSkip = 1;
+}
+
 /^} / {
        split($2, t, ";")                       # remove ;
-       type = t[1]
-        codeSkip = 1
+  if (!type)
+    type = t[1]
+  codeSkip = 1
+  next
+}
 
+END {
        if (sbuf) print "#include \"SBuf.h\""
        print "#include \"" nspath type ".h\""
 
@@ -71,5 +89,4 @@ codeSkip == 1         { next }
        print "\t" Element[i]
        print "};"
        if (namespace) print "}; // namespace " namespace
-       next
 }