2006-05-31 01:20:18 +00:00
|
|
|
#! /usr/bin/awk -f
|
2006-05-09 10:58:38 +00:00
|
|
|
# vim:ts=4:sw=4
|
|
|
|
# process eaccelerator/opcodes.c
|
|
|
|
BEGIN {
|
|
|
|
FS=" "
|
|
|
|
max = 0;
|
|
|
|
started = 0
|
|
|
|
}
|
|
|
|
|
|
|
|
/OPDEF/ {
|
|
|
|
if (started) {
|
2008-08-17 14:19:25 +00:00
|
|
|
name = "";
|
|
|
|
if (match($0, /"([^"]+)"/, m)) {
|
|
|
|
name = m[1];
|
|
|
|
}
|
|
|
|
sub(/"[^"]*"/, "");
|
2006-05-09 10:58:38 +00:00
|
|
|
if (!match($0, /EXT_([^ |]+).*OP[1S]_([^ |]+).*OP2_([^ |]+).*RES_([^ |)]+).*/, array)) {
|
|
|
|
print "error" $0
|
|
|
|
exit
|
|
|
|
}
|
2008-08-17 14:19:25 +00:00
|
|
|
id = "";
|
|
|
|
if (match($0, /\/\* *([0-9]+) *\*\//, comments)) {
|
|
|
|
id = comments[1];
|
2008-02-17 16:49:46 +00:00
|
|
|
}
|
2008-08-17 14:19:25 +00:00
|
|
|
printf "\tOPSPEC(%10s, %10s, %10s, %10s) /* %s %-30s */\n", array[1], array[2], array[3], array[4], id, name;
|
2006-05-09 10:58:38 +00:00
|
|
|
next
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/^}/ {
|
|
|
|
print $0
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
/^[ ]*,[ ]*$/ {
|
|
|
|
next
|
|
|
|
}
|
|
|
|
{
|
|
|
|
if (started) {
|
|
|
|
print $0
|
|
|
|
next
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/^static/ {
|
|
|
|
started = 1;
|
|
|
|
print "static const xc_opcode_spec_t xc_opcode_spec[] = {"
|
|
|
|
}
|