]>
git.saurik.com Git - bison.git/blob - lib/bitsetv-print.c
2 Copyright (C) 2001, 2002, 2004, 2006, 2009 Free Software Foundation,
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #include "bitsetv-print.h"
24 /*--------------------------------------------------------.
25 | Display the MATRIX array of SIZE bitsets of size SIZE. |
26 `--------------------------------------------------------*/
29 bitsetv_matrix_dump (FILE * out
, const char *title
, bitsetv bset
)
32 bitset_bindex hsize
= bitset_size (bset
[0]);
35 fprintf (out
, "%s BEGIN\n", title
);
39 for (i
= 0; i
< hsize
; ++i
)
40 putc (i
/ 10 ? '0' + i
/ 10 : ' ', out
);
43 for (i
= 0; i
< hsize
; ++i
)
44 fprintf (out
, "%d", (int) (i
% 10));
49 for (i
= 0; i
< hsize
; ++i
)
54 for (i
= 0; bset
[i
]; ++i
)
56 fprintf (out
, "%2lu|", (unsigned long int) i
);
57 for (j
= 0; j
< hsize
; ++j
)
58 fputs (bitset_test (bset
[i
], j
) ? "1" : " ", out
);
64 for (i
= 0; i
< hsize
; ++i
)
69 fprintf (out
, "%s END\n\n", title
);