From: Amos Jeffries Date: Sun, 23 Jan 2011 06:41:41 +0000 (-0700) Subject: Support namespace in enum strings generator X-Git-Tag: take03^2~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=331632e567bdb4bbe0ce604ac06d311719d39419;p=thirdparty%2Fsquid.git Support namespace in enum strings generator For now only one level of namespace is supported. Header files using namespaces are also required to exist in a sub-folder of the same name in accordance with the SourceLayout design. --- diff --git a/src/mk-string-arrays.awk b/src/mk-string-arrays.awk index d4b5ec3751..42133a3f5c 100644 --- a/src/mk-string-arrays.awk +++ b/src/mk-string-arrays.awk @@ -14,9 +14,17 @@ BEGIN { print "/*" print " * Auto-Generated File. Changes will be destroyed." print " */" - print "#include \"squid.h\"" + print "#include \"config.h\"" codeSkip = 1 e = 0 + nspath = "" +} + +# when namespace is encountered store it +/^namespace [a-zA-Z]+/ { + nspath = tolower($2) "/" # nested folder + namespace = $2 # code namespace reconstruct + next } # Skip all lines outside of typedef {} @@ -34,11 +42,17 @@ codeSkip == 1 { next } type = t[1] codeSkip = 1 - print "#include \"" type ".h\"" + print "#include \"" nspath type ".h\"" + + # if namesapce is not empty ?? + if (namespace) print "namespace " namespace + if (namespace) print "{" + print "\nconst char *" type "_str[] = {" for ( i = 1; i < e; ++i) print "\t\"" Element[i] "\"," print "\t\"" Element[i] "\"" print "};" + if (namespace) print "}; // namespace " namespace next }