1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Mathias Preiner, Aina Niemetz |
4 |
|
* |
5 |
|
* This file is part of the cvc5 project. |
6 |
|
* |
7 |
|
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS |
8 |
|
* in the top-level source directory and their institutional affiliations. |
9 |
|
* All rights reserved. See the file COPYING in the top-level source |
10 |
|
* directory for licensing information. |
11 |
|
* **************************************************************************** |
12 |
|
* |
13 |
|
* Option template for option modules. |
14 |
|
* |
15 |
|
* For each <module>_options.toml configuration file, mkoptions.py |
16 |
|
* expands this template and generates a <module>_options.cpp file. |
17 |
|
*/ |
18 |
|
#include "options/printer_options.h" |
19 |
|
|
20 |
|
#include <iostream> |
21 |
|
|
22 |
|
#include "base/check.h" |
23 |
|
#include "options/option_exception.h" |
24 |
|
|
25 |
|
namespace cvc5::options { |
26 |
|
|
27 |
|
// clang-format off |
28 |
|
std::ostream& operator<<(std::ostream& os, PrintInstMode mode) |
29 |
|
{ |
30 |
|
switch(mode) |
31 |
|
{ |
32 |
|
case PrintInstMode::NUM: return os << "PrintInstMode::NUM"; |
33 |
|
case PrintInstMode::LIST: return os << "PrintInstMode::LIST"; |
34 |
|
default: Unreachable(); |
35 |
|
} |
36 |
|
return os; |
37 |
|
} |
38 |
1 |
PrintInstMode stringToPrintInstMode(const std::string& optarg) |
39 |
|
{ |
40 |
1 |
if (optarg == "num") return PrintInstMode::NUM; |
41 |
|
else if (optarg == "list") return PrintInstMode::LIST; |
42 |
|
else if (optarg == "help") |
43 |
|
{ |
44 |
|
std::cerr << R"FOOBAR( |
45 |
|
Print format for printing instantiations. |
46 |
|
Available modes for --print-inst are: |
47 |
|
+ num |
48 |
|
Print the total number of instantiations per quantified formula, when |
49 |
|
non-zero. |
50 |
|
+ list (default) |
51 |
|
Print the list of instantiations per quantified formula, when non-empty. |
52 |
|
)FOOBAR"; |
53 |
|
std::exit(1); |
54 |
|
} |
55 |
|
throw OptionException(std::string("unknown option for --print-inst: `") + |
56 |
|
optarg + "'. Try --print-inst=help."); |
57 |
|
} |
58 |
|
// clang-format on |
59 |
|
|
60 |
|
namespace printer |
61 |
|
{ |
62 |
|
// clang-format off |
63 |
|
void setDefaultFlattenHOChains(Options& opts, bool value) |
64 |
|
{ |
65 |
|
if (!opts.printer.flattenHOChainsWasSetByUser) opts.printer.flattenHOChains = value; |
66 |
|
} |
67 |
|
void setDefaultPrintInstMode(Options& opts, PrintInstMode value) |
68 |
|
{ |
69 |
|
if (!opts.printer.printInstModeWasSetByUser) opts.printer.printInstMode = value; |
70 |
|
} |
71 |
|
void setDefaultPrintInstFull(Options& opts, bool value) |
72 |
|
{ |
73 |
|
if (!opts.printer.printInstFullWasSetByUser) opts.printer.printInstFull = value; |
74 |
|
} |
75 |
|
// clang-format on |
76 |
|
} |
77 |
|
|
78 |
22755 |
} // namespace cvc5::options |