hawk/scripts/generrcode.hawk

34 lines
578 B
Plaintext
Raw Permalink Normal View History

2019-12-13 04:29:58 +00:00
#
# generrcode.hawk
2019-12-13 04:29:58 +00:00
#
# hawk -f generrcode.hawk hawk-cmn.h
2019-12-13 04:29:58 +00:00
#
BEGIN {
collect=0;
tab3="\t\t";
tab4="\t\t\t";
}
2020-01-01 14:16:01 +00:00
/^[[:space:]]*enum[[:space:]]+hawk_errnum_t[[:space:]]*$/ {
2019-12-13 04:29:58 +00:00
collect=1;
print tab3 "// generated by generrcode.awk";
print tab3 "enum ErrorNumber";
print tab3 "{";
}
collect && /^[[:space:]]*};[[:space:]]*$/ {
print tab3 "};";
print tab3 "// end of enum ErrorNumber";
print "";
collect=0;
}
2020-01-01 14:16:01 +00:00
collect && /^[[:space:]]*HAWK_E[[:alnum:]]+/ {
2019-12-13 04:29:58 +00:00
split ($1, flds, ",");
name=flds[1];
2020-01-01 14:16:01 +00:00
print tab4 "ERR_" substr (name,7,length(name)-6) " = " name ",";
2019-12-13 04:29:58 +00:00
}