Commit 0d00ab24 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

bin: --stats=%x to count atomic propositions

* bin/common_aoutput.cc, bin/common_aoutput.hh: Implement %x and %X.
* tests/core/remprop.test: Test them.
* NEWS: Mention them.
parent dd5a8208
New in spot 2.3.1.dev (not yet released) New in spot 2.3.1.dev (not yet released)
Nothing yet. Tools:
- In tools that output automata the number of atomic propositions
can be output using --stats=%x (output automaton) or --stats=%X
(input automaton).
New in spot 2.3.1 (2017-02-20) New in spot 2.3.1 (2017-02-20)
......
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2012, 2013, 2014, 2015, 2016 Laboratoire de Recherche // Copyright (C) 2012-2017 Laboratoire de Recherche et Développement
// 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.
// //
...@@ -193,6 +193,8 @@ static const argp_option io_options[] = ...@@ -193,6 +193,8 @@ static const argp_option io_options[] =
"wall-clock time elapsed in seconds (excluding parsing)", 0 }, "wall-clock time elapsed in seconds (excluding parsing)", 0 },
{ "%W, %w", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, { "%W, %w", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"one word accepted by the automaton", 0 }, "one word accepted by the automaton", 0 },
{ "%X, %x", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of atomic propositions declared in the automaton", 0 },
{ "%%", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, { "%%", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"a single %", 0 }, "a single %", 0 },
{ "%<", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, { "%<", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
...@@ -228,6 +230,8 @@ static const argp_option o_options[] = ...@@ -228,6 +230,8 @@ static const argp_option o_options[] =
"number of transitions", 0 }, "number of transitions", 0 },
{ "%a", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, { "%a", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of acceptance sets", 0 }, "number of acceptance sets", 0 },
{ "%b", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of acceptance sets", 0 },
{ "%g", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, { "%g", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"acceptance condition (in HOA syntax)", 0 }, "acceptance condition (in HOA syntax)", 0 },
{ "%c, %[LETTERS]c", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, { "%c, %[LETTERS]c", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
...@@ -250,6 +254,8 @@ static const argp_option o_options[] = ...@@ -250,6 +254,8 @@ static const argp_option o_options[] =
"wall-clock time elapsed in seconds (excluding parsing)", 0 }, "wall-clock time elapsed in seconds (excluding parsing)", 0 },
{ "%w", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, { "%w", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"one word accepted by the output automaton", 0 }, "one word accepted by the output automaton", 0 },
{ "%x", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of atomic propositions declared in the automaton", 0 },
{ "%%", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, { "%%", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"a single %", 0 }, "a single %", 0 },
{ nullptr, 0, nullptr, 0, nullptr, 0 } { nullptr, 0, nullptr, 0, nullptr, 0 }
...@@ -361,6 +367,7 @@ hoa_stat_printer::hoa_stat_printer(std::ostream& os, const char* format, ...@@ -361,6 +367,7 @@ hoa_stat_printer::hoa_stat_printer(std::ostream& os, const char* format,
declare('S', &haut_states_); declare('S', &haut_states_);
declare('T', &haut_trans_); declare('T', &haut_trans_);
declare('W', &haut_word_); declare('W', &haut_word_);
declare('X', &haut_ap_size_);
} }
declare('<', &csv_prefix_); declare('<', &csv_prefix_);
declare('>', &csv_suffix_); declare('>', &csv_suffix_);
...@@ -372,6 +379,7 @@ hoa_stat_printer::hoa_stat_printer(std::ostream& os, const char* format, ...@@ -372,6 +379,7 @@ hoa_stat_printer::hoa_stat_printer(std::ostream& os, const char* format,
declare('h', &output_aut_); declare('h', &output_aut_);
declare('m', &aut_name_); declare('m', &aut_name_);
declare('w', &aut_word_); declare('w', &aut_word_);
declare('x', &aut_ap_size_);
} }
std::ostream& std::ostream&
...@@ -467,6 +475,8 @@ hoa_stat_printer::print(const spot::const_parsed_aut_ptr& haut, ...@@ -467,6 +475,8 @@ hoa_stat_printer::print(const spot::const_parsed_aut_ptr& haut,
haut_word_.val().clear(); haut_word_.val().clear();
} }
} }
if (has('X'))
haut_ap_size_ = haut->aut->ap().size();
} }
if (has('m')) if (has('m'))
...@@ -490,6 +500,8 @@ hoa_stat_printer::print(const spot::const_parsed_aut_ptr& haut, ...@@ -490,6 +500,8 @@ hoa_stat_printer::print(const spot::const_parsed_aut_ptr& haut,
aut_word_.val().clear(); aut_word_.val().clear();
} }
} }
if (has('x'))
aut_ap_size_ = aut->ap().size();
auto& res = this->spot::stat_printer::print(aut, f, run_time); auto& res = this->spot::stat_printer::print(aut, f, run_time);
// Make sure we do not store the automaton until the next one is // Make sure we do not store the automaton until the next one is
......
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2014, 2015, 2016 Laboratoire de Recherche et // Copyright (C) 2014-2017 Laboratoire de Recherche et Développement
// 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.
// //
...@@ -144,6 +144,8 @@ private: ...@@ -144,6 +144,8 @@ private:
spot::printable_value<unsigned> haut_edges_; spot::printable_value<unsigned> haut_edges_;
spot::printable_value<unsigned> haut_trans_; spot::printable_value<unsigned> haut_trans_;
spot::printable_value<unsigned> haut_acc_; spot::printable_value<unsigned> haut_acc_;
spot::printable_value<unsigned> haut_ap_size_;
spot::printable_value<unsigned> aut_ap_size_;
spot::printable_scc_info haut_scc_; spot::printable_scc_info haut_scc_;
spot::printable_value<unsigned> haut_deterministic_; spot::printable_value<unsigned> haut_deterministic_;
spot::printable_value<unsigned> haut_nondetstates_; spot::printable_value<unsigned> haut_nondetstates_;
......
#! /bin/sh #! /bin/sh
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2015, 2016 Laboratoire de Recherche et Développement de # Copyright (C) 2015-2017 Laboratoire de Recherche et Développement de
# l'Epita (LRDE). # l'Epita (LRDE).
# #
# This file is part of Spot, a model checking library. # This file is part of Spot, a model checking library.
...@@ -47,6 +47,7 @@ EOF ...@@ -47,6 +47,7 @@ EOF
cat >expected <<EOF cat >expected <<EOF
HOA: v1 HOA: v1
name: "3->1"
States: 4 States: 4
Start: 0 Start: 0
AP: 1 "c" AP: 1 "c"
...@@ -68,7 +69,7 @@ State: 3 ...@@ -68,7 +69,7 @@ State: 3
--END-- --END--
EOF EOF
run 0 autfilt -H --remove-ap=a,b automaton >out run 0 autfilt -H --remove-ap=a,b --name='%X->%x' automaton >out
cat out cat out
diff out expected diff out expected
......
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