diff options
author | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-04-21 15:40:54 -0700 |
---|---|---|
committer | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-04-21 15:50:47 -0700 |
commit | 405879699ccdcaea544635814c63fafd46b5af03 (patch) | |
tree | cc327229fd86c3cc2202bbee4303a78a7ecd1fd9 | |
parent | 15a7a3792e6b130f6a354305133d28ab9d3778e2 (diff) |
enum-to-names-vals: cleanup
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
-rwxr-xr-x | lib/enum-to-names-vals | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/enum-to-names-vals b/lib/enum-to-names-vals index 9d27bd8..bc7224a 100755 --- a/lib/enum-to-names-vals +++ b/lib/enum-to-names-vals @@ -18,7 +18,10 @@ const struct { } ${type}_names_vals[] = { EOF awk -vtype=$type -vtype_regex="^${type}_" ' \ -BEGIN { IGNORECASE = 1; } \ +BEGIN { \ + IGNORECASE = 1; \ +} \ + \ $1 ~ type_regex { \ name=$1; \ symbol=$1; \ @@ -28,6 +31,12 @@ $1 ~ type_regex { \ gsub(/,.*$/, "", name); \ gsub(/_/, "-", name); \ print "\t{ " symbol ", \"" tolower(name) "\" },"; \ -}' $@ -echo " { 0, NULL }" -echo "};" + valid = valid tolower(name) " "; \ +} \ + \ +END { \ + print " { 0, NULL }"; \ + print "};"; \ + print "const char " type "_valid_str[] = \"" valid "\";"; \ + print ""; \ +} ' $@ |