#!/usr/bin/perl # mkdmpfct < recnamefile # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # This little program produces the dump routines in the dmp.b module. What # # you do is let the make build the cm4_record.h or cm4_msgtyp.h file, and # # when you need to implement the dump code for a new message, feed the record # # (type) names to this program. The output will be a set of routines that # # accept the named record and dump the first few fields that a common to most # # of them. If you want the rest of the record dumped, you will have to add # # the rest of the fields by hand. But at least this gets you to where things # # will compile and a one-line dump routine will exist. See also the mkdmpcase # # program that generates the cases in dmpcmmsg that calls these dump # # routines. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # for (<>) { if (/C[TM]([34]_\w+)\s/) { $name = $1; print "\n"; print "DM$name(p)\n"; print " CM$name* p;\n"; print "{\n"; print ":7 H7(p,sizeof(CM$name),\"CMmsg\");\n"; print " P1(\"CM$name %02X=%u=%s r=%02X=%d devid=%02X=%d.\"\n"; print " ,ntohs(p->type),ntohs(p->type)\n"; print " ,ntohs(p->reqid),ntohs(p->reqid)\n"; print " ,ntohs(p->devid),ntohs(p->devid)\n"; print " );\n"; print "}\n"; } }