* src/closure.c: here.
(set_firsts): Use bitsetv_reflexive_transitive_closure instead of
RTC.
* src/warshall.h, src/warshall.c: Remove.
* tests/sets.at (Broken Closure): Adjust.
+2002-03-04 Akim Demaille <akim@epita.fr>
+
+ * src/warshall.h, src/warshall.c (bitmatrix_print): Move to...
+ * src/closure.c: here.
+ (set_firsts): Use bitsetv_reflexive_transitive_closure instead of
+ RTC.
+ * src/warshall.h, src/warshall.c: Remove.
+ * tests/sets.at (Broken Closure): Adjust.
+
2002-03-04 Akim Demaille <akim@epita.fr>
* src/output.c (output_skeleton): tempdir is const.
print_graph.h print_graph.c \
muscle_tab.h muscle_tab.c \
options.h options.c \
- print.c reader.c reduce.c symtab.c warshall.c vcg.c \
+ print.c reader.c reduce.c symtab.c vcg.c \
scan-skel.l
BUILT_SOURCES = scan-skel.c
noinst_HEADERS = LR0.h closure.h complain.h conflicts.h \
derives.h \
files.h getargs.h gram.h lalr.h lex.h nullable.h \
- print.h reader.h reduce.h symtab.h warshall.h system.h \
+ print.h reader.h reduce.h symtab.h system.h \
types.h vcg.h vcg_defaults.h
EXTRA_DIST = build.com bison.cld vmshlp.mar
#include "reader.h"
#include "closure.h"
#include "derives.h"
-#include "warshall.h"
/* NITEMSET is the size of the array ITEMSET. */
short *itemset;
}
fprintf (stderr, "\n\n");
}
+
+/*--------------------------------------------------------.
+| Display the MATRIX array of SIZE bitsets of size SIZE. |
+`--------------------------------------------------------*/
+
+static void
+bitmatrix_print (const char *title, bitsetv matrix)
+{
+ size_t i, j;
+ size_t size = bitset_size (matrix[0]);
+
+ /* Title. */
+ fprintf (stderr, "%s BEGIN\n", title);
+
+ /* Column numbers. */
+ fputs (" ", stderr);
+ for (i = 0; i < size; ++i)
+ putc (i / 10 ? '0' + i / 10 : ' ', stderr);
+ putc ('\n', stderr);
+ fputs (" ", stderr);
+ for (i = 0; i < size; ++i)
+ fprintf (stderr, "%d", i % 10);
+ putc ('\n', stderr);
+
+ /* Bar. */
+ fputs (" .", stderr);
+ for (i = 0; i < size; ++i)
+ putc ('-', stderr);
+ fputs (".\n", stderr);
+
+ /* Contents. */
+ for (i = 0; i < size; ++i)
+ {
+ fprintf (stderr, "%2d|", i);
+ for (j = 0; j < size; ++j)
+ fputs (bitset_test (matrix[i], j) ? "1" : " ", stderr);
+ fputs ("|\n", stderr);
+ }
+
+ /* Bar. */
+ fputs (" `", stderr);
+ for (i = 0; i < size; ++i)
+ putc ('-', stderr);
+ fputs ("'\n", stderr);
+
+ /* End title. */
+ fprintf (stderr, "%s END\n\n", title);
+}
\f
/*------------------------------------------------------------------.
| Set FIRSTS to be an NVARS array of NVARS bitsets indicating which |
bitset_set (FIRSTS (i), symbol - ntokens);
}
- RTC (firsts);
+ if (trace_flag)
+ bitmatrix_print ("RTC: Input", firsts);
+ bitsetv_reflexive_transitive_closure (firsts);
+ if (trace_flag)
+ bitmatrix_print ("RTC: Output", firsts);
if (trace_flag)
print_firsts ();
+++ /dev/null
-/* Generate transitive closure of a matrix,
- Copyright 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
-
- This file is part of Bison, the GNU Compiler Compiler.
-
- Bison is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- Bison is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Bison; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-
-#include "system.h"
-#include "getargs.h"
-#include "bitsetv.h"
-#include "warshall.h"
-
-/*--------------------------------------------------------.
-| Display the MATRIX array of SIZE bitsets of size SIZE. |
-`--------------------------------------------------------*/
-
-static void
-bitmatrix_print (const char *title, bitsetv matrix)
-{
- size_t i, j;
- size_t size = bitset_size (matrix[0]);
-
- /* Title. */
- fprintf (stderr, "%s BEGIN\n", title);
-
- /* Column numbers. */
- fputs (" ", stderr);
- for (i = 0; i < size; ++i)
- putc (i / 10 ? '0' + i / 10 : ' ', stderr);
- putc ('\n', stderr);
- fputs (" ", stderr);
- for (i = 0; i < size; ++i)
- fprintf (stderr, "%d", i % 10);
- putc ('\n', stderr);
-
- /* Bar. */
- fputs (" .", stderr);
- for (i = 0; i < size; ++i)
- putc ('-', stderr);
- fputs (".\n", stderr);
-
- /* Contents. */
- for (i = 0; i < size; ++i)
- {
- fprintf (stderr, "%2d|", i);
- for (j = 0; j < size; ++j)
- fputs (bitset_test (matrix[i], j) ? "1" : " ", stderr);
- fputs ("|\n", stderr);
- }
-
- /* Bar. */
- fputs (" `", stderr);
- for (i = 0; i < size; ++i)
- putc ('-', stderr);
- fputs ("'\n", stderr);
-
- /* End title. */
- fprintf (stderr, "%s END\n\n", title);
-}
-
-/*-------------------------------------------------------------------.
-| Given the MATRIX array of N bitsets of size N, modify its contents |
-| to be the transive closure of what was given. |
-`-------------------------------------------------------------------*/
-
-static void
-TC (bitsetv matrix)
-{
- int i, j;
-
- if (trace_flag)
- bitmatrix_print ("TC: Input", matrix);
-
- /* R (J, I) && R (I, K) => R (J, K).
- I *must* be the outter loop. */
-
- for (i = 0; matrix[i]; ++i)
- for (j = 0; matrix[j]; ++j)
- if (bitset_test (matrix[j], i))
- bitset_or (matrix[j], matrix[j], matrix[i]);
-
- if (trace_flag)
- bitmatrix_print ("TC: Output", matrix);
-}
-
-
-/*---------------------------------------------------------------.
-| Reflexive Transitive Closure. Same as TC and then set all the |
-| bits on the diagonal of MATRIX. |
-`---------------------------------------------------------------*/
-
-void
-RTC (bitsetv matrix)
-{
- int i;
-
- TC (matrix);
- for (i = 0; matrix[i]; ++i)
- bitset_set (matrix[i], i);
-}
+++ /dev/null
-/* Generate transitive closure of a matrix,
- Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
-
- This file is part of Bison, the GNU Compiler Compiler.
-
- Bison is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- Bison is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Bison; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#ifndef WARSHALL_H_
-# define WARSHALL_H_
-
-void RTC PARAMS ((bitsetv));
-#endif /* !WARSHALL_H_ */
AT_CHECK([[bison --trace input.y]], [], [], [stderr])
-AT_CHECK([[sed -n 's/[ ]*$//;/^TC: Output BEGIN/,/^TC: Output END/p' stderr]], [],
-[[TC: Output BEGIN
+AT_CHECK([[sed -n 's/[ ]*$//;/^RTC: Output BEGIN/,/^RTC: Output END/p' stderr]], [],
+[[RTC: Output BEGIN
012345678
.---------.
- 0| 11111111|
- 1| 1111111|
- 2| 111111|
- 3| 11111|
- 4| 1111|
- 5| 111|
- 6| 11|
- 7| 1|
- 8| |
+ 0|111111111|
+ 1| 11111111|
+ 2| 1111111|
+ 3| 111111|
+ 4| 11111|
+ 5| 1111|
+ 6| 111|
+ 7| 11|
+ 8| 1|
`---------'
-TC: Output END
+RTC: Output END
]])
AT_CLEANUP