printers.awk (404B)
1 BEGIN { 2 FS = "\\(|\\)|, " 3 OFS = ", " 4 print "typedef struct {" 5 } 6 7 $1 == "MPERS_PRINTER_DECL" { 8 printf " %s (*%s)(%s", $2, $3, $4 9 for (i = 5; i < NF; ++i) 10 printf ", %s", $i 11 print ");" 12 print "#define " $3 " MPERS_PRINTER_NAME(" $3 ")\n" 13 } 14 15 END { 16 print "} struct_printers;" 17 print "extern const struct_printers *printers;" 18 print "#define MPERS_PRINTER_NAME(printer_name) printers->printer_name" 19 }