xref: /csrg-svn/old/lib2648/dumpmat.c (revision 19787)
1*19787Sdist /*
2*19787Sdist  * Copyright (c) 1980 Regents of the University of California.
3*19787Sdist  * All rights reserved.  The Berkeley software License Agreement
4*19787Sdist  * specifies the terms and conditions for redistribution.
5*19787Sdist  */
611470Sralph 
7*19787Sdist #ifndef lint
8*19787Sdist static char sccsid[] = "@(#)dumpmat.c	5.1 (Berkeley) 04/30/85";
9*19787Sdist #endif not lint
10*19787Sdist 
1111470Sralph #include "bit.h"
1211470Sralph 
1311470Sralph #ifdef TRACE
1411470Sralph /*
1511470Sralph  * dumpmat: debugging dumpmat of a window or other bit matrix.
1611470Sralph  * msg is a handy label, m is the matrix, rows, cols is the size of the matrix.
1711470Sralph  */
dumpmat(msg,m,rows,cols)1811470Sralph dumpmat(msg, m, rows, cols)
1911470Sralph char *msg;
2011470Sralph bitmat m;
2111470Sralph int rows, cols;
2211470Sralph {
2311470Sralph 	register int r, c;
2411470Sralph 	int r1, r2, c1, c2;
2511470Sralph 
2611470Sralph 	if (trace == NULL)
2711470Sralph 		return;
2811470Sralph 	fprintf(trace, "\ndumpmat %s, m=%x, rows=%d, cols=%d\n", msg, m, rows, cols);
2911470Sralph 	minmax(m, rows, cols, &r1, &c1, &r2, &c2);
3011470Sralph 	fprintf(trace, "r1=%d, r2=%d, c1=%d, c2=%d\n", r1, r2, c1, c2);
3111470Sralph 	for (r=r1; r<=r2; r++) {
3211470Sralph 		fprintf(trace, "%2d ", r);
3311470Sralph 		for (c=c1; c<=c2; c++)
3411470Sralph 			fprintf(trace, "%c", mat(m, rows, cols, r, c, 5) ? 'X' : '.');
3511470Sralph 		fprintf(trace, "\n");
3611470Sralph 	}
3711470Sralph 	fprintf(trace, "\n");
3811470Sralph }
3912981Ssam #endif
40