randomltl: avoid #define

As this pollutes the user's namespace.

* spot/tl/randomltl.hh: Use class-level enum and constexpr instead
of #define.
* spot/tl/randomltl.cc, python/spot/__init__.py, bin/randltl.cc,
tests/python/dualize.py, tests/python/sum.py: Adjust usage.
This commit is contained in:
Alexandre Duret-Lutz 2018-05-16 17:38:59 +02:00
parent 565e25502c
commit fc0ed01a45
6 changed files with 33 additions and 37 deletions

View file

@ -411,7 +411,7 @@ namespace spot
simpl_(tl_simplifier_options{opt_simpl_level_})
{
aprops_ = aprops;
output_ = opts.get("output", OUTPUTLTL);
output_ = opts.get("output", randltlgenerator::LTL);
opt_seed_ = opts.get("seed", 0);
opt_tree_size_min_ = opts.get("tree_size_min", 15);
opt_tree_size_max_ = opts.get("tree_size_max", 15);
@ -424,7 +424,7 @@ namespace spot
switch (output_)
{
case OUTPUTLTL:
case randltlgenerator::LTL:
rf_ = new random_ltl(&aprops_);
if (opt_pS)
throw std::invalid_argument("Cannot set sere priorities with "
@ -434,7 +434,7 @@ namespace spot
"LTL output");
tok_pL = rf_->parse_options(opt_pL);
break;
case OUTPUTBOOL:
case randltlgenerator::Bool:
rf_ = new random_boolean(&aprops_);
tok_pB = rf_->parse_options(opt_pB);
if (opt_pL)
@ -444,7 +444,7 @@ namespace spot
throw std::invalid_argument("Cannot set sere priorities "
"with Boolean output");
break;
case OUTPUTSERE:
case randltlgenerator::SERE:
rf_ = rs_ = new random_sere(&aprops_);
tok_pS = rs_->parse_options(opt_pS);
tok_pB = rs_->rb.parse_options(opt_pB);
@ -452,7 +452,7 @@ namespace spot
throw std::invalid_argument("Cannot set ltl priorities "
"with SERE output");
break;
case OUTPUTPSL:
case randltlgenerator::PSL:
rf_ = rp_ = new random_psl(&aprops_);
rs_ = &rp_->rs;
tok_pL = rp_->parse_options(opt_pL);

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016 Laboratoire de
// Copyright (C) 2010-2016, 2018 Laboratoire de
// Recherche et Développement de l'Epita (LRDE).
// Copyright (C) 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -30,12 +30,6 @@
#include <spot/misc/hash.hh>
#include <spot/tl/simplify.hh>
#define OUTPUTBOOL 1
#define OUTPUTLTL 2
#define OUTPUTSERE 3
#define OUTPUTPSL 4
#define MAX_TRIALS 100000
namespace spot
{
/// \ingroup tl_io
@ -305,6 +299,9 @@ namespace spot
public:
enum output_type { Bool, LTL, SERE, PSL };
static constexpr unsigned MAX_TRIALS = 100000U;
randltlgenerator(int aprops_n, const option_map& opts,
char* opt_pL = nullptr,
char* opt_pS = nullptr,