xref: /original-bsd/old/lib2648/dumpmat.c (revision 027d3621)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  */
6 
7 #ifndef lint
8 static char sccsid[] = "@(#)dumpmat.c	5.1 (Berkeley) 04/30/85";
9 #endif not lint
10 
11 #include "bit.h"
12 
13 #ifdef TRACE
14 /*
15  * dumpmat: debugging dumpmat of a window or other bit matrix.
16  * msg is a handy label, m is the matrix, rows, cols is the size of the matrix.
17  */
dumpmat(msg,m,rows,cols)18 dumpmat(msg, m, rows, cols)
19 char *msg;
20 bitmat m;
21 int rows, cols;
22 {
23 	register int r, c;
24 	int r1, r2, c1, c2;
25 
26 	if (trace == NULL)
27 		return;
28 	fprintf(trace, "\ndumpmat %s, m=%x, rows=%d, cols=%d\n", msg, m, rows, cols);
29 	minmax(m, rows, cols, &r1, &c1, &r2, &c2);
30 	fprintf(trace, "r1=%d, r2=%d, c1=%d, c2=%d\n", r1, r2, c1, c2);
31 	for (r=r1; r<=r2; r++) {
32 		fprintf(trace, "%2d ", r);
33 		for (c=c1; c<=c2; c++)
34 			fprintf(trace, "%c", mat(m, rows, cols, r, c, 5) ? 'X' : '.');
35 		fprintf(trace, "\n");
36 	}
37 	fprintf(trace, "\n");
38 }
39 #endif
40