tgbaparse: Return a tgba_digraph.

* src/tgbaparse/parsedecl.hh, src/tgbaparse/public.hh,
src/tgbaparse/tgbaparse.yy: Adjust to return a tgba_digraph.
* src/priv/accmap.hh: New file to help creating acceptance
conditions from strings.
* src/priv/Makefile.am: Add accmap.hh
* src/tgba/tgbagraph.hh (tgba_digraph::named_t): New typedef.
* wrap/python/spot.i: Declare that tgba_digraph inherits from tgba.
* src/tgbatest/complementation.cc, src/tgbatest/explpro2.test,
src/tgbatest/explpro3.test, src/tgbatest/explpro4.test,
src/tgbatest/explprod.cc, src/tgbatest/explprod.test,
src/tgbatest/ltl2tgba.cc, src/tgbatest/maskacc.cc,
src/tgbatest/maskacc.test, src/tgbatest/mixprod.cc,
src/tgbatest/powerset.cc, src/tgbatest/randtgba.test,
src/tgbatest/readsave.test, src/tgbatest/tgbaread.cc,
src/tgbatest/tgbaread.test, src/tgbatest/tripprod.cc,
src/tgbatest/tripprod.test: Adjust to the change.
This commit is contained in:
Alexandre Duret-Lutz 2014-06-26 23:07:33 +02:00
parent c0b28dc9c8
commit 4170080c35
24 changed files with 277 additions and 159 deletions

View file

@ -130,7 +130,7 @@ int main(int argc, char* argv[])
{
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::tgba_parse_error_list pel;
spot::tgba_explicit_string* a = spot::tgba_parse(file, pel, dict, env);
spot::tgba* a = spot::tgba_parse(file, pel, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, file, pel))
return 2;

View file

@ -1,9 +1,10 @@
#!/bin/sh
# Copyright (C) 2013 Laboratoire de Recherche et Développement de
# l'Epita (LRDE).
# -*- coding: utf-8 -*-
# Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
# Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Laboratoire
# d'Informatique de Paris 6 (LIP6), département Systèmes Répartis
# Coopératifs (SRC), Université Pierre et Marie Curie.
# d'Informatique de Paris 6 (LIP6), département Systèmes Répartis
# Coopératifs (SRC), Université Pierre et Marie Curie.
#
# This file is part of Spot, a model checking library.
#
@ -39,8 +40,8 @@ EOF
cat >expected <<'EOF'
acc = "p2$1" "p3" "p2" "p1";
"s1 * s1", "s2 * s2", "!a & b", "p2$1" "p1";
"s1 * s1", "s3 * s3", "a & !b", "p3" "p2";
"0 * 0", "1 * 1", "!a & b", "p2$1" "p1";
"0 * 0", "2 * 2", "a & !b", "p3" "p2";
EOF
run 0 ../explprod input1 input2 | tee stdout

View file

@ -1,8 +1,9 @@
#!/bin/sh
# Copyright (C) 2009 Laboratoire de Recherche et Développement
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2014 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# et Marie Curie.
#
# This file is part of Spot, a model checking library.
@ -39,8 +40,8 @@ EOF
cat >expected <<EOF
acc = "p2" "p3";
"s1 * s1", "s2 * s2", "!a & b", "p2";
"s1 * s1", "s3 * s3", "a & !b", "p3";
"0 * 0", "1 * 1", "!a & b", "p2";
"0 * 0", "2 * 2", "a & !b", "p3";
EOF
run 0 ../explprod input1 input2 |

View file

@ -1,8 +1,9 @@
#!/bin/sh
# Copyright (C) 2009 Laboratoire de Recherche et Développement
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2014 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
# Copyright (C) 2006 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# et Marie Curie.
#
# This file is part of Spot, a model checking library.
@ -39,8 +40,8 @@ EOF
cat >expected <<'EOF'
acc = "p1$1" "p1";
"s1 * s1", "s1 * s1", "a", "p1";
"s1 * s1", "s1 * s1", "!a", "p1$1";
"0 * 0", "0 * 0", "a", "p1";
"0 * 0", "0 * 0", "!a", "p1$1";
EOF
run 0 ../explprod input1 input2 > stdout

View file

@ -1,7 +1,8 @@
// Copyright (C) 2008 Laboratoire de Recherche et Développement
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
@ -47,11 +48,11 @@ main(int argc, char** argv)
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::tgba_parse_error_list pel1;
spot::tgba_explicit_string* a1 = spot::tgba_parse(argv[1], pel1, dict, env);
spot::tgba* a1 = spot::tgba_parse(argv[1], pel1, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[1], pel1))
return 2;
spot::tgba_parse_error_list pel2;
spot::tgba_explicit_string* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
spot::tgba* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[2], pel2))
return 2;

View file

@ -1,9 +1,10 @@
#!/bin/sh
# Copyright (C) 2008, 2009, 2013 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
# -*- coding: utf-8 -*-
# Copyright (C) 2008, 2009, 2013, 2014 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de
# Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
# Université Pierre et Marie Curie.
# Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
# Université Pierre et Marie Curie.
#
# This file is part of Spot, a model checking library.
#
@ -41,9 +42,9 @@ EOF
cat >expected <<EOF
acc = "p3" "p2" "p1";
"s1 * s1", "s3 * s2", "a & b", "p2" "p1";
"s1 * s1", "s2 * s2", "b", "p2" "p1";
"s2 * s2", "s3 * s1", "a & c", "p3" "p1";
"0 * 0", "1 * 1", "a & b", "p2" "p1";
"0 * 0", "2 * 1", "b", "p2" "p1";
"2 * 1", "1 * 0", "a & c", "p3" "p1";
EOF
run 0 ../explprod input1 input2 | tee stdout

View file

@ -676,7 +676,7 @@ main(int argc, char** argv)
tm.start("reading -P's argument");
spot::tgba_parse_error_list pel;
spot::tgba_explicit_string* s;
spot::tgba_digraph* s;
s = spot::tgba_parse(argv[formula_index] + 2,
pel, dict, env, env, debug_opt);
if (spot::format_tgba_parse_errors(std::cerr,
@ -1096,6 +1096,7 @@ main(int argc, char** argv)
{
case ReadSpot:
{
spot::tgba_digraph* e;
spot::tgba_parse_error_list pel;
tm.start("parsing automaton");
to_free = a = e = spot::tgba_parse(input, pel, dict,
@ -1107,6 +1108,7 @@ main(int argc, char** argv)
delete dict;
return 2;
}
e->merge_transitions();
}
break;
case ReadNeverclaim:

View file

@ -1,3 +1,4 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
@ -43,7 +44,7 @@ main(int argc, char** argv)
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::tgba_parse_error_list pel;
spot::tgba_explicit_string* aut = spot::tgba_parse(argv[1], pel, dict, env);
spot::tgba* aut = spot::tgba_parse(argv[1], pel, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[1], pel))
return 2;

View file

@ -35,15 +35,15 @@ EOF
cat >expect1 <<EOF
acc = "B" "A";
"s1", "s3", "b", "B";
"s3", "s2", "b",;
"s2", "s3", "a",;
"s2", "s4", "a", "B";
"0", "2", "b", "B";
"2", "1", "b",;
"1", "2", "a",;
"1", "3", "a", "B";
acc = "B" "A";
"s1", "s2", "a", "A";
"s2", "s3", "a",;
"s3", "s2", "b",;
"s3", "s4", "b", "A";
"0", "1", "a", "A";
"1", "2", "a",;
"2", "1", "b",;
"2", "3", "b", "A";
EOF
run 0 ../maskacc input1 | tee stdout

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2009, 2012 Laboratoire de Recherche et
// Copyright (C) 2008, 2009, 2012, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
@ -56,7 +56,7 @@ main(int argc, char** argv)
return 2;
spot::tgba_parse_error_list pel2;
spot::tgba_explicit_string* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
spot::tgba* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[2], pel2))
return 2;

View file

@ -1,8 +1,9 @@
// Copyright (C) 2008 Laboratoire de Recherche et Développement
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
@ -48,7 +49,7 @@ main(int argc, char** argv)
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::tgba_parse_error_list pel;
spot::tgba_explicit_string* a = spot::tgba_parse(argv[1], pel, dict, env);
spot::tgba* a = spot::tgba_parse(argv[1], pel, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[1], pel))
return 2;

View file

@ -1,5 +1,7 @@
#!/bin/sh
# Copyright (C) 2010 Laboratoire de Recherche et Development de l'EPITA.
# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2014 Laboratoire de Recherche et Development de
# l'EPITA.
#
# This file is part of Spot, a model checking library.
#
@ -23,7 +25,7 @@ set -e
for n in 10 20 30 40 50 60 70 80 90 100 200 500 1000; do
# Make sure graph generated by randtgba have successors for each
# of their $n nodes.
r=`../randtgba -n $n a b c | sed -n 's/^"S\([0-9]*\)".*/\1/p' |
r=`../randtgba -n $n a b c | sed -n 's/^"\([0-9]*\)".*/\1/p' |
sort -u | wc -l`
if test "$r" -eq "$n"; then :; else
echo "test failed for n=$n"

View file

@ -1,8 +1,9 @@
#!/bin/sh
# Copyright (C) 2009, 2010, 2012 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2012, 2014 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# et Marie Curie.
#
# This file is part of Spot, a model checking library.
@ -36,9 +37,9 @@ EOF
cat >expected <<\EOF
acc = "c" "d";
"s1", "s2", "a & !b", "c" "d";
"s2", "state 3", "\"F\\G\"", "c";
"state 3", "s1", "1",;
"0", "1", "a & !b", "c" "d";
"1", "2", "\"F\\G\"", "c";
"2", "0", "1",;
EOF
# Sort out some possible inversions in the output.
@ -71,10 +72,10 @@ EOF
cat >expected <<\EOF
acc = "c";
"s1", "s2", "a", "c";
"s1", "s2", "!b",;
"s2", "s1", "!b",;
"s2", "s1", "a", "c";
"0", "1", "a", "c";
"0", "1", "!b",;
"1", "0", "!b",;
"1", "0", "a", "c";
EOF
run 0 ../ltl2tgba -b -X input > stdout
@ -85,13 +86,18 @@ run 0 ../randtgba -t 1 -n 20 -d 0.2 a b -a 2 0.1 >input
sed 's/"b & a"/"a \& b"/g;s/"a1" "a0"/"a0" "a1"/g' input > tmp_ &&
mv tmp_ input
cat input
# the first read-write can renumber the states
run 0 ../ltl2tgba -b -X input > stdout
sed 's/"b & a"/"a \& b"/g;s/"a1" "a0"/"a0" "a1"/g' stdout > tmp_ &&
mv tmp_ stdout
mv tmp_ stdout
test `wc -l < input` = `wc -l < stdout`
# But this second shout output the same as the first
run 0 ../ltl2tgba -b -X input > stdout2
sed 's/"b & a"/"a \& b"/g;s/"a1" "a0"/"a0" "a1"/g' stdout2 > tmp_ &&
mv tmp_ stdout2
diff stdout stdout2
diff input stdout
rm -f input stdout
rm -f input stdout stdout2
# Check the position of syntax errors in the diagnostics:

View file

@ -1,8 +1,9 @@
// Copyright (C) 2008 Laboratoire de Recherche et Développement
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
@ -56,8 +57,8 @@ main(int argc, char** argv)
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::tgba_parse_error_list pel;
spot::tgba_explicit_string* a = spot::tgba_parse(argv[filename_index],
pel, dict, env, env, debug);
spot::tgba* a = spot::tgba_parse(argv[filename_index],
pel, dict, env, env, debug);
if (spot::format_tgba_parse_errors(std::cerr, argv[filename_index], pel))
return 2;

View file

@ -1,5 +1,5 @@
#!/bin/sh
# Copyright (C) 2009 Laboratoire de Recherche et Développement
# Copyright (C) 2009, 2014 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -38,11 +38,11 @@ cat >expected <<EOF
digraph G {
0 [label="", style=invis, height=0]
0 -> 1
1 [label="s1"]
1 [label="0"]
1 -> 2 [label="a & !b\n{Acc[d], Acc[c]}"]
2 [label="s2"]
2 [label="1"]
2 -> 3 [label="a\n{Acc[c]}"]
3 [label="state 3"]
3 [label="2"]
3 -> 1 [label="1\n"]
}
EOF

View file

@ -1,8 +1,9 @@
// Copyright (C) 2008 Laboratoire de Recherche et Développement
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
@ -47,15 +48,15 @@ main(int argc, char** argv)
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::tgba_parse_error_list pel1;
spot::tgba_explicit_string* a1 = spot::tgba_parse(argv[1], pel1, dict, env);
spot::tgba* a1 = spot::tgba_parse(argv[1], pel1, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[1], pel1))
return 2;
spot::tgba_parse_error_list pel2;
spot::tgba_explicit_string* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
spot::tgba* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[2], pel2))
return 2;
spot::tgba_parse_error_list pel3;
spot::tgba_explicit_string* a3 = spot::tgba_parse(argv[3], pel3, dict, env);
spot::tgba* a3 = spot::tgba_parse(argv[3], pel3, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[3], pel3))
return 2;

View file

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (C) 2008, 2009, 2013 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
# Copyright (C) 2008, 2009, 2013, 2014 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de
# Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
# Université Pierre et Marie Curie.
@ -49,12 +49,12 @@ EOF
cat >expected <<EOF
acc = "p4" "p3" "p2" "p1";
"s1 * s1 * s1", "s3 * s2 * s2", "a & b", "p2" "p1";
"s1 * s1 * s1", "s2 * s2 * s2", "a & b", "p2" "p1";
"s1 * s1 * s1", "s3 * s2 * s3", "a & b", "p2" "p1";
"s1 * s1 * s1", "s2 * s2 * s3", "b", "p2" "p1";
"s2 * s2 * s2", "s3 * s1 * s3", "a & c", "p4" "p3";
"s2 * s2 * s3", "s3 * s1 * s2", "a & c", "p4" "p3";
"0 * 0 * 0", "1 * 1 * 1", "a & b", "p2" "p1";
"0 * 0 * 0", "2 * 1 * 1", "a & b", "p2" "p1";
"0 * 0 * 0", "1 * 1 * 2", "a & b", "p2" "p1";
"0 * 0 * 0", "2 * 1 * 2", "b", "p2" "p1";
"2 * 1 * 1", "1 * 0 * 2", "a & c", "p4" "p3";
"2 * 1 * 2", "1 * 0 * 1", "a & c", "p4" "p3";
EOF
run 0 ../tripprod input1 input2 input3 | tee stdout