]> git.saurik.com Git - bison.git/blame - lib/bitsetv-print.c
build: re-enable compiler warnings, and fix them
[bison.git] / lib / bitsetv-print.c
CommitLineData
1565b720 1/* Bitset vectors.
7d424de1 2
3209eb1c 3 Copyright (C) 2001-2002, 2004, 2006, 2009-2015 Free Software
e141f4d4 4 Foundation, Inc.
1565b720 5
f16b0819 6 This program is free software: you can redistribute it and/or modify
02650b7f 7 it under the terms of the GNU General Public License as published by
f16b0819 8 the Free Software Foundation, either version 3 of the License, or
02650b7f 9 (at your option) any later version.
1565b720 10
02650b7f
PE
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
1565b720 15
02650b7f 16 You should have received a copy of the GNU General Public License
f16b0819 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
1565b720 18
231ed89a 19#include <config.h>
1565b720 20
1565b720
AD
21#include "bitsetv-print.h"
22
231ed89a
PE
23#include <stdlib.h>
24
1565b720
AD
25/*--------------------------------------------------------.
26| Display the MATRIX array of SIZE bitsets of size SIZE. |
27`--------------------------------------------------------*/
28
29void
30bitsetv_matrix_dump (FILE * out, const char *title, bitsetv bset)
31{
4fc71aa3
PE
32 bitset_bindex i, j;
33 bitset_bindex hsize = bitset_size (bset[0]);
1565b720
AD
34
35 /* Title. */
36 fprintf (out, "%s BEGIN\n", title);
37
38 /* Column numbers. */
39 fputs (" ", out);
40 for (i = 0; i < hsize; ++i)
41 putc (i / 10 ? '0' + i / 10 : ' ', out);
42 putc ('\n', out);
43 fputs (" ", out);
44 for (i = 0; i < hsize; ++i)
4fc71aa3 45 fprintf (out, "%d", (int) (i % 10));
1565b720
AD
46 putc ('\n', out);
47
48 /* Bar. */
49 fputs (" .", out);
50 for (i = 0; i < hsize; ++i)
51 putc ('-', out);
52 fputs (".\n", out);
53
54 /* Contents. */
55 for (i = 0; bset[i]; ++i)
56 {
779e7ceb 57 fprintf (out, "%2lu|", (unsigned long int) i);
1565b720 58 for (j = 0; j < hsize; ++j)
e9690142 59 fputs (bitset_test (bset[i], j) ? "1" : " ", out);
1565b720
AD
60 fputs ("|\n", out);
61 }
62
63 /* Bar. */
64 fputs (" `", out);
65 for (i = 0; i < hsize; ++i)
66 putc ('-', out);
67 fputs ("'\n", out);
68
69 /* End title. */
70 fprintf (out, "%s END\n\n", title);
71}