]> git.saurik.com Git - bison.git/blame - lib/bitsetv-print.c
(quotearg_buffer_restyled): Fix off-by-two bug in trigraph handling.
[bison.git] / lib / bitsetv-print.c
CommitLineData
1565b720 1/* Bitset vectors.
4fc71aa3 2 Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1565b720
AD
3
4This file is part of Bison.
5
6Bison is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 2, or (at your option) any later
9version.
10
11Bison is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with Bison; see the file COPYING. If not, write to the Free
18Software Foundation, 59 Temple Place - Suite 330, Boston, MA
1902111-1307, USA. */
20
21#ifdef HAVE_CONFIG_H
22#include "config.h"
23#endif
24
25#include <stdlib.h>
26#include "bitsetv-print.h"
27
28/*--------------------------------------------------------.
29| Display the MATRIX array of SIZE bitsets of size SIZE. |
30`--------------------------------------------------------*/
31
32void
33bitsetv_matrix_dump (FILE * out, const char *title, bitsetv bset)
34{
4fc71aa3
PE
35 bitset_bindex i, j;
36 bitset_bindex hsize = bitset_size (bset[0]);
1565b720
AD
37
38 /* Title. */
39 fprintf (out, "%s BEGIN\n", title);
40
41 /* Column numbers. */
42 fputs (" ", out);
43 for (i = 0; i < hsize; ++i)
44 putc (i / 10 ? '0' + i / 10 : ' ', out);
45 putc ('\n', out);
46 fputs (" ", out);
47 for (i = 0; i < hsize; ++i)
4fc71aa3 48 fprintf (out, "%d", (int) (i % 10));
1565b720
AD
49 putc ('\n', out);
50
51 /* Bar. */
52 fputs (" .", out);
53 for (i = 0; i < hsize; ++i)
54 putc ('-', out);
55 fputs (".\n", out);
56
57 /* Contents. */
58 for (i = 0; bset[i]; ++i)
59 {
4fc71aa3 60 fprintf (out, "%2lu|", (unsigned long) i);
1565b720
AD
61 for (j = 0; j < hsize; ++j)
62 fputs (bitset_test (bset[i], j) ? "1" : " ", out);
63 fputs ("|\n", out);
64 }
65
66 /* Bar. */
67 fputs (" `", out);
68 for (i = 0; i < hsize; ++i)
69 putc ('-', out);
70 fputs ("'\n", out);
71
72 /* End title. */
73 fprintf (out, "%s END\n\n", title);
74}