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