ack/util/opt/pop_push.awk

32 lines
823 B
Awk
Raw Normal View History

1990-07-18 16:31:32 +00:00
BEGIN { print "#define CONDBRA '\001'" > "pop_push.h"
print "#define JUMP '\002'" >> "pop_push.h"
print "#define HASLABEL '\004'" >> "pop_push.h"
print "#include \"pop_push.h\""
print
print "char *pop_push[] = {"
print "\"\","
switch = 0
}
/aar/ { switch = NR }
{ if (switch) {
1990-07-26 15:08:49 +00:00
printf("/* %s */ \"%s\",\n",$1,$3)
1990-07-18 16:31:32 +00:00
col_2[NR-switch] = $2
1990-07-26 15:08:49 +00:00
comment[NR-switch] = $1
1990-07-18 16:31:32 +00:00
}
}
END { print "};"
print
print "char flow_tab[]= {"
print "'\000',"
for(i=0; i < NR-switch; i++) {
inf = col_2[i]
1990-07-26 15:08:49 +00:00
f_out = "/* " comment[i] " */ "
if (substr(inf,1,1)=="b") f_out = f_out "HASLABEL|"
1990-07-18 16:31:32 +00:00
if (substr(inf,2,1)=="c") f_out = f_out "CONDBRA"
else if (substr(inf,2,1)=="t") f_out = f_out "JUMP"
1990-07-26 15:08:49 +00:00
else f_out = f_out "'\000'"
1990-07-18 16:31:32 +00:00
print f_out","
}
print "};"
}