ack/mach/proto/mcg/ircodes.sh

37 lines
386 B
Bash
Raw Normal View History

#!/bin/sh
in=$1
header=$2
source=$3
awk -f - $in >$header << "EOF"
BEGIN {
print "enum ir_opcode {"
}
/^[^#]+/ {
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