ltl2tgba, ltldo: add a --negate option

Suggested by Victor Khomenko.

* bin/ltl2tgba.cc, bin/ltldo.cc: Implement it.
* doc/org/hierarchy.org: Use it.
* tests/core/ltldo2.test: Test it.
* bin/common_output.cc: Typo.
* NEWS: Mention the new option.
This commit is contained in:
Alexandre Duret-Lutz 2019-09-22 22:01:46 +02:00
parent be389c5c25
commit 7f21d3ff29
6 changed files with 56 additions and 11 deletions

View file

@ -1,5 +1,5 @@
// -*- 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).
//
// This file is part of Spot, a model checking library.
@ -46,6 +46,7 @@ the smallest Transition-based Generalized Büchi Automata, \
output in the HOA format.\n\
If multiple formulas are supplied, several automata will be output.";
enum { OPT_NEGATE = 256 };
static const argp_option options[] =
{
@ -59,6 +60,7 @@ static const argp_option options[] =
"the part of the line after the formula if it "
"comes from a column extracted from a CSV file", 4 },
/**************************************************/
{ "negate", OPT_NEGATE, nullptr, 0, "negate each formula", 1 },
{ "unambiguous", 'U', nullptr, 0, "output unambiguous automata", 2 },
{ nullptr, 0, nullptr, 0, "Miscellaneous options:", -1 },
{ "extra-options", 'x', "OPTS", 0,
@ -76,6 +78,7 @@ const struct argp_child children[] =
{ nullptr, 0, nullptr, 0 }
};
static bool negate = false;
static spot::option_map extra_options;
static spot::postprocessor::output_pref unambig = 0;
@ -95,6 +98,9 @@ parse_opt(int key, char* arg, struct argp_state*)
error(2, 0, "failed to parse --options near '%s'", opt);
}
break;
case OPT_NEGATE:
negate = true;
break;
case ARGP_KEY_ARG:
// FIXME: use stat() to distinguish filename from string?
if (*arg == '-' && !arg[1])
@ -139,6 +145,9 @@ namespace
s.c_str());
}
if (negate)
f = spot::formula::Not(f);
spot::process_timer timer;
timer.start();
auto aut = trans.run(&f);