#!/usr/bin/perl
#	mkdmpfct < recnamefile
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# This little program produces the cases in dmpcmmsg().  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.  It will spit out dmpcmmsg's cases for those names, which can #
# be pasted into dmpcmmsg.b and compiled.  They will, of course, call a bunch #
# of  new  routines  whose names start with "DM4_"; adding those (in dmp.b is #
# the best place) is the job of the mkdmpfct program.                         #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #

for (<>) {
	if (/C[TM]([34]_\w+)\s/) {
		$name = $1;
		print "#ifdef	 CT$name\n";
		print "	case CT$name:\n";
#		print ":5		D5(\"CM type %d=CM$name\",t);\n";
		print ":3		if (n != sizeof(CM$name))\n";
		print ":3			D4(msgsiz,n,\"CM$name\",sizeof(CM$name));\n";
		print "		DM$name(p);\n";
		print "		break;\n";
		print "#endif\n";
	}
}
