[Quiz] Proper symbols list

This commit is contained in:
Romain Goyet
2015-09-03 22:55:51 +02:00
parent 90abba689a
commit 3e29ff1236

View File

@@ -1,11 +1,17 @@
BEGIN {
print "void * pointers[] = {"
}
#FIXME: Is there a way to capture subexpression in awk? The following gsub is
# kind of ugly
/TEST\(([a-z0-9_]+)\)/ { gsub(/(TEST\()|(\))/, "", $1); print "test_" $1 "," }
/TEST\(([a-z0-9_]+)\)/ { gsub(/(TEST\()|(\))/, "", $1); tests = tests "," $1 }
END {
a = tests;
b = tests;
gsub(/,/, "();\nvoid ", a);
sub(/\(\);\n/, "", a);
print a "();";
print "";
print "void * pointers[] = {";
sub(/,/, "", b);
gsub(/,/, ",\n", b);
print b;
print "};"
}