2016-09-18 21:24:54 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
in=$1
|
|
|
|
header=$2
|
|
|
|
source=$3
|
|
|
|
|
2016-09-21 22:15:48 +00:00
|
|
|
awk -f - $in >$header << "EOF"
|
|
|
|
BEGIN {
|
|
|
|
print "enum {"
|
|
|
|
}
|
2016-09-18 21:24:54 +00:00
|
|
|
|
2016-09-21 22:15:48 +00:00
|
|
|
/^[^#]+/ {
|
|
|
|
print "\tIR_" $1 ","
|
|
|
|
}
|
|
|
|
|
|
|
|
END {
|
|
|
|
print "};"
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
awk -f - $in >$source << "EOF"
|
|
|
|
BEGIN {
|
|
|
|
print "#include \"mcg.h\""
|
|
|
|
print "#include \"ir.h\""
|
|
|
|
print "const char* ir_names[] = {"
|
|
|
|
}
|
|
|
|
|
|
|
|
/^[^#]+/ {
|
|
|
|
printf("\t\"%s\",\n", $1)
|
|
|
|
}
|
|
|
|
|
|
|
|
END {
|
|
|
|
print "};"
|
|
|
|
}
|
|
|
|
EOF
|
2016-09-18 21:24:54 +00:00
|
|
|
|