Commit 62836490 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

dot: add option 'g'

* spot/twaalgos/dot.cc: Implement support for hidding labels.
* tests/core/readsave.test: Test it.
* bin/common_aoutput.cc: Add --help text.
* NEWS: Mention it.
parent 8aafe74a
Pipeline #7824 passed with stages
in 520 minutes and 31 seconds
...@@ -35,6 +35,10 @@ New in spot 2.7.2.dev (not yet released) ...@@ -35,6 +35,10 @@ New in spot 2.7.2.dev (not yet released)
by spot::generic_emptiness_check() when processing SCCs by spot::generic_emptiness_check() when processing SCCs
recursively, and makes it easier to write similar code in Python. recursively, and makes it easier to write similar code in Python.
- print_dot has a new option 'g', to hide edge labels. This is
helpful to display automata as "graphs", e.g., when illustrating
algorithms that do not care about labels.
Bugs fixed: Bugs fixed:
- When processing CSV files with MSDOS-style \r\n line endings, - When processing CSV files with MSDOS-style \r\n line endings,
......
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2012-2018 Laboratoire de Recherche et Développement // Copyright (C) 2012-2019 Laboratoire de Recherche et Développement
// de l'Epita (LRDE). // de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
...@@ -101,6 +101,7 @@ static const argp_option options[] = ...@@ -101,6 +101,7 @@ static const argp_option options[] =
"(d) show origins when known, " "(d) show origins when known, "
"(e) force elliptic nodes, " "(e) force elliptic nodes, "
"(f(FONT)) use FONT, " "(f(FONT)) use FONT, "
"(g) hide edge labels, "
"(h) horizontal layout, " "(h) horizontal layout, "
"(k) use state labels when possible, " "(k) use state labels when possible, "
"(K) use transition labels (default), " "(K) use transition labels (default), "
......
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012, 2014-2018 Laboratoire de Recherche // Copyright (C) 2011, 2012, 2014-2019 Laboratoire de Recherche
// et Développement de l'Epita (LRDE). // et Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // 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
...@@ -108,6 +108,7 @@ namespace spot ...@@ -108,6 +108,7 @@ namespace spot
bool opt_orig_show_ = false; bool opt_orig_show_ = false;
bool max_states_given_ = false; // related to max_states_ bool max_states_given_ = false; // related to max_states_
bool opt_latex_ = false; bool opt_latex_ = false;
bool opt_showlabel_ = true;
const char* nl_ = "\\n"; const char* nl_ = "\\n";
const char* label_pre_ = "label=\""; const char* label_pre_ = "label=\"";
char label_post_ = '"'; char label_post_ = '"';
...@@ -266,6 +267,9 @@ namespace spot ...@@ -266,6 +267,9 @@ namespace spot
options = end + 1; options = end + 1;
} }
break; break;
case 'g': // "graphs" are unlabeled automata
opt_showlabel_ = false;
break;
case 'h': case 'h':
opt_vertical_ = false; opt_vertical_ = false;
break; break;
...@@ -756,12 +760,12 @@ namespace spot ...@@ -756,12 +760,12 @@ namespace spot
os_ << '.' << iter->second % palette_mod; os_ << '.' << iter->second % palette_mod;
} }
os_ << " [" << label_pre_; os_ << " [" << label_pre_;
if (!opt_state_labels_) if (!opt_state_labels_ && opt_showlabel_)
format_label(os_, t.cond); format_label(os_, t.cond);
if (!mark_states_) if (!mark_states_)
if (auto a = t.acc) if (auto a = t.acc)
{ {
if (!opt_state_labels_) if (!opt_state_labels_ && opt_showlabel_)
os_ << nl_; os_ << nl_;
output_mark(a); output_mark(a);
} }
......
#!/bin/sh #!/bin/sh
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2012, 2014-2018 Laboratoire de # Copyright (C) 2009, 2010, 2012, 2014-2019 Laboratoire de
# Recherche et Développement de l'Epita (LRDE). # Recherche et Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), # 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
...@@ -390,6 +390,25 @@ digraph "G(Fa & Fb)" { ...@@ -390,6 +390,25 @@ digraph "G(Fa & Fb)" {
EOF EOF
diff output expected diff output expected
ltl2tgba -dbang 'GFa & GFb' >output
cat output
cat >expected <<EOF
digraph "G(Fa & Fb)" {
rankdir=LR
label="G(Fa & Fb)\nInf(⓿)&Inf(❶)\n[gen. Büchi 2]"
labelloc="t"
node [shape="circle"]
I [label="", style=invis, width=0]
I -> 0
0 [label="0"]
0 -> 0 [label=""]
0 -> 0 [label="❶"]
0 -> 0 [label="⓿"]
0 -> 0 [label="⓿❶"]
}
EOF
diff output expected
SPOT_DOTDEFAULT=bra ltl2tgba --dot='Ae.f(Lato)' 'GFa & GFb' >output SPOT_DOTDEFAULT=bra ltl2tgba --dot='Ae.f(Lato)' 'GFa & GFb' >output
cat output cat output
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment