xref: /csrg-svn/old/lib2648/dumpmat.c (revision 11470)
1*11470Sralph /*	dumpmat.c	4.1	83/03/09	*/
2*11470Sralph 
3*11470Sralph #include "bit.h"
4*11470Sralph 
5*11470Sralph #ifdef TRACE
6*11470Sralph /*
7*11470Sralph  * dumpmat: debugging dumpmat of a window or other bit matrix.
8*11470Sralph  * msg is a handy label, m is the matrix, rows, cols is the size of the matrix.
9*11470Sralph  */
10*11470Sralph dumpmat(msg, m, rows, cols)
11*11470Sralph char *msg;
12*11470Sralph bitmat m;
13*11470Sralph int rows, cols;
14*11470Sralph {
15*11470Sralph 	register int r, c;
16*11470Sralph 	int r1, r2, c1, c2;
17*11470Sralph 
18*11470Sralph 	if (trace == NULL)
19*11470Sralph 		return;
20*11470Sralph 	fprintf(trace, "\ndumpmat %s, m=%x, rows=%d, cols=%d\n", msg, m, rows, cols);
21*11470Sralph 	minmax(m, rows, cols, &r1, &c1, &r2, &c2);
22*11470Sralph 	fprintf(trace, "r1=%d, r2=%d, c1=%d, c2=%d\n", r1, r2, c1, c2);
23*11470Sralph 	for (r=r1; r<=r2; r++) {
24*11470Sralph 		fprintf(trace, "%2d ", r);
25*11470Sralph 		for (c=c1; c<=c2; c++)
26*11470Sralph 			fprintf(trace, "%c", mat(m, rows, cols, r, c, 5) ? 'X' : '.');
27*11470Sralph 		fprintf(trace, "\n");
28*11470Sralph 	}
29*11470Sralph 	fprintf(trace, "\n");
30*11470Sralph }
31