ref: d551e92f989a1c010e684f6d9f1ee07539c836a5
parent: d47a56d8314f1c3d7e98c26fb6d132038faeb0b2
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Sep 21 05:00:14 EDT 2017
[cc2] Simplifies the error generation script
--- a/cc2/generror.awk
+++ b/cc2/generror.awk
@@ -1,11 +1,9 @@
-BEGIN {
- print "char *errlist[] = {"
-}
-/^enum nerrors \{/ {inhome = 1}
+/^enum nerrors \{/ {print "char *errlist[] = {"; inhome = 1}
+
inhome && /E[A-Z]*, / {sub(/,/, "", $1)
printf("\t[%s] = \"", $1)
- for (i = 3; i < NF-1; ++i)
- printf("%s ", $i)
- printf("%s\",\n", $(NF-1));}
-inhome && /^}/ {print "};" ; inhome = 0}
+ for (i = 3; i <= NF-1; ++i)
+ printf("%s%s", $i, (i == NF-1) ? "\"" : " ")
+ print ","}
+inhome && /^}/ {print "};" ; inhome = 0}