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 |
|
* Contains code for handling command-line options. |
14 |
|
* |
15 |
|
* For each <module>_options.toml configuration file, mkoptions.py |
16 |
|
* expands this template and generates a <module>_options.h file. |
17 |
|
*/ |
18 |
|
|
19 |
|
#include "cvc5_public.h" |
20 |
|
|
21 |
|
#ifndef CVC5__OPTIONS__BASE_H |
22 |
|
#define CVC5__OPTIONS__BASE_H |
23 |
|
|
24 |
|
#include "options/options.h" |
25 |
|
|
26 |
|
// clang-format off |
27 |
|
#include "options/language.h" |
28 |
|
#include "options/managed_streams.h" |
29 |
|
#include <bitset> |
30 |
|
#include <iostream> |
31 |
|
// clang-format on |
32 |
|
|
33 |
|
namespace cvc5::options { |
34 |
|
|
35 |
|
// clang-format off |
36 |
|
|
37 |
|
enum class OutputTag |
38 |
|
{ |
39 |
|
INST, |
40 |
|
TRIGGER, |
41 |
|
SYGUS |
42 |
|
}; |
43 |
|
|
44 |
|
static constexpr size_t OutputTag__numValues = 3; |
45 |
|
|
46 |
|
std::ostream& operator<<(std::ostream& os, OutputTag mode); |
47 |
|
OutputTag stringToOutputTag(const std::string& optarg); |
48 |
|
// clang-format on |
49 |
|
|
50 |
|
#if defined(CVC5_MUZZLED) || defined(CVC5_COMPETITION_MODE) |
51 |
|
# define DO_SEMANTIC_CHECKS_BY_DEFAULT false |
52 |
|
#else /* CVC5_MUZZLED || CVC5_COMPETITION_MODE */ |
53 |
|
# define DO_SEMANTIC_CHECKS_BY_DEFAULT true |
54 |
|
#endif /* CVC5_MUZZLED || CVC5_COMPETITION_MODE */ |
55 |
|
|
56 |
69186 |
struct HolderBASE |
57 |
|
{ |
58 |
|
// clang-format off |
59 |
|
ManagedErr err; |
60 |
|
bool errWasSetByUser = false; |
61 |
|
ManagedIn in; |
62 |
|
bool inWasSetByUser = false; |
63 |
|
bool incrementalSolving = true; |
64 |
|
bool incrementalSolvingWasSetByUser = false; |
65 |
|
InputLanguage inputLanguage = language::input::LANG_AUTO; |
66 |
|
bool inputLanguageWasSetByUser = false; |
67 |
|
bool languageHelp; |
68 |
|
bool languageHelpWasSetByUser = false; |
69 |
|
ManagedOut out; |
70 |
|
bool outWasSetByUser = false; |
71 |
|
OutputLanguage outputLanguage = language::output::LANG_AUTO; |
72 |
|
bool outputLanguageWasSetByUser = false; |
73 |
|
OutputTag outputTag; |
74 |
|
bool outputTagWasSetByUser = false; |
75 |
|
std::bitset<OutputTag__numValues> outputTagHolder; |
76 |
|
bool outputTagHolderWasSetByUser = false; |
77 |
|
bool parseOnly; |
78 |
|
bool parseOnlyWasSetByUser = false; |
79 |
|
bool preprocessOnly; |
80 |
|
bool preprocessOnlyWasSetByUser = false; |
81 |
|
bool printSuccess; |
82 |
|
bool printSuccessWasSetByUser = false; |
83 |
|
std::vector<std::string> resourceWeightHolder; |
84 |
|
bool resourceWeightHolderWasSetByUser = false; |
85 |
|
uint64_t perCallResourceLimit; |
86 |
|
bool perCallResourceLimitWasSetByUser = false; |
87 |
|
uint64_t cumulativeResourceLimit; |
88 |
|
bool cumulativeResourceLimitWasSetByUser = false; |
89 |
|
bool statistics; |
90 |
|
bool statisticsWasSetByUser = false; |
91 |
|
bool statisticsAll; |
92 |
|
bool statisticsAllWasSetByUser = false; |
93 |
|
bool statisticsEveryQuery = false; |
94 |
|
bool statisticsEveryQueryWasSetByUser = false; |
95 |
|
bool statisticsExpert; |
96 |
|
bool statisticsExpertWasSetByUser = false; |
97 |
|
uint64_t perCallMillisecondLimit; |
98 |
|
bool perCallMillisecondLimitWasSetByUser = false; |
99 |
|
uint64_t cumulativeMillisecondLimit; |
100 |
|
bool cumulativeMillisecondLimitWasSetByUser = false; |
101 |
|
int64_t verbosity = 0; |
102 |
|
bool verbosityWasSetByUser = false; |
103 |
|
// clang-format on |
104 |
|
}; |
105 |
|
|
106 |
|
#undef DO_SEMANTIC_CHECKS_BY_DEFAULT |
107 |
|
|
108 |
|
// clang-format off |
109 |
|
inline ManagedErr err() { return Options::current().base.err; } |
110 |
|
inline ManagedIn in() { return Options::current().base.in; } |
111 |
8972536 |
inline bool incrementalSolving() { return Options::current().base.incrementalSolving; } |
112 |
89266 |
inline InputLanguage inputLanguage() { return Options::current().base.inputLanguage; } |
113 |
|
inline bool languageHelp() { return Options::current().base.languageHelp; } |
114 |
|
inline ManagedOut out() { return Options::current().base.out; } |
115 |
43781 |
inline OutputLanguage outputLanguage() { return Options::current().base.outputLanguage; } |
116 |
|
inline OutputTag outputTag() { return Options::current().base.outputTag; } |
117 |
67908 |
inline std::bitset<OutputTag__numValues> outputTagHolder() { return Options::current().base.outputTagHolder; } |
118 |
|
inline bool parseOnly() { return Options::current().base.parseOnly; } |
119 |
15204 |
inline bool preprocessOnly() { return Options::current().base.preprocessOnly; } |
120 |
|
inline bool printSuccess() { return Options::current().base.printSuccess; } |
121 |
|
inline std::vector<std::string> resourceWeightHolder() { return Options::current().base.resourceWeightHolder; } |
122 |
|
inline uint64_t perCallResourceLimit() { return Options::current().base.perCallResourceLimit; } |
123 |
|
inline uint64_t cumulativeResourceLimit() { return Options::current().base.cumulativeResourceLimit; } |
124 |
|
inline bool statistics() { return Options::current().base.statistics; } |
125 |
|
inline bool statisticsAll() { return Options::current().base.statisticsAll; } |
126 |
|
inline bool statisticsEveryQuery() { return Options::current().base.statisticsEveryQuery; } |
127 |
|
inline bool statisticsExpert() { return Options::current().base.statisticsExpert; } |
128 |
|
inline uint64_t perCallMillisecondLimit() { return Options::current().base.perCallMillisecondLimit; } |
129 |
|
inline uint64_t cumulativeMillisecondLimit() { return Options::current().base.cumulativeMillisecondLimit; } |
130 |
15201 |
inline int64_t verbosity() { return Options::current().base.verbosity; } |
131 |
|
// clang-format on |
132 |
|
|
133 |
|
namespace base |
134 |
|
{ |
135 |
|
// clang-format off |
136 |
|
static constexpr const char* err__name = "err"; |
137 |
|
static constexpr const char* in__name = "in"; |
138 |
|
static constexpr const char* incrementalSolving__name = "incremental"; |
139 |
|
static constexpr const char* inputLanguage__name = "lang"; |
140 |
|
static constexpr const char* languageHelp__name = ""; |
141 |
|
static constexpr const char* out__name = "out"; |
142 |
|
static constexpr const char* outputLanguage__name = "output-lang"; |
143 |
|
static constexpr const char* outputTag__name = "output"; |
144 |
|
static constexpr const char* outputTagHolder__name = ""; |
145 |
|
static constexpr const char* parseOnly__name = "parse-only"; |
146 |
|
static constexpr const char* preprocessOnly__name = "preprocess-only"; |
147 |
|
static constexpr const char* printSuccess__name = "print-success"; |
148 |
|
static constexpr const char* resourceWeightHolder__name = ""; |
149 |
|
static constexpr const char* perCallResourceLimit__name = "rlimit-per"; |
150 |
|
static constexpr const char* cumulativeResourceLimit__name = "rlimit"; |
151 |
|
static constexpr const char* statistics__name = "stats"; |
152 |
|
static constexpr const char* statisticsAll__name = "stats-all"; |
153 |
|
static constexpr const char* statisticsEveryQuery__name = "stats-every-query"; |
154 |
|
static constexpr const char* statisticsExpert__name = "stats-expert"; |
155 |
|
static constexpr const char* perCallMillisecondLimit__name = "tlimit-per"; |
156 |
|
static constexpr const char* cumulativeMillisecondLimit__name = "tlimit"; |
157 |
|
static constexpr const char* verbosity__name = "verbosity"; |
158 |
|
|
159 |
|
void setDefaultErr(Options& opts, ManagedErr value);void setDefaultIn(Options& opts, ManagedIn value);void setDefaultIncrementalSolving(Options& opts, bool value);void setDefaultInputLanguage(Options& opts, InputLanguage value);void setDefaultLanguageHelp(Options& opts, bool value);void setDefaultOut(Options& opts, ManagedOut value);void setDefaultOutputLanguage(Options& opts, OutputLanguage value);void setDefaultOutputTag(Options& opts, OutputTag value);void setDefaultOutputTagHolder(Options& opts, std::bitset<OutputTag__numValues> value);void setDefaultParseOnly(Options& opts, bool value);void setDefaultPreprocessOnly(Options& opts, bool value);void setDefaultPrintSuccess(Options& opts, bool value);void setDefaultResourceWeightHolder(Options& opts, std::vector<std::string> value);void setDefaultPerCallResourceLimit(Options& opts, uint64_t value);void setDefaultCumulativeResourceLimit(Options& opts, uint64_t value);void setDefaultStatistics(Options& opts, bool value);void setDefaultStatisticsAll(Options& opts, bool value);void setDefaultStatisticsEveryQuery(Options& opts, bool value);void setDefaultStatisticsExpert(Options& opts, bool value);void setDefaultPerCallMillisecondLimit(Options& opts, uint64_t value);void setDefaultCumulativeMillisecondLimit(Options& opts, uint64_t value);void setDefaultVerbosity(Options& opts, int64_t value); |
160 |
|
// clang-format on |
161 |
|
} |
162 |
|
|
163 |
|
} // namespace cvc5::options |
164 |
|
|
165 |
|
#endif /* CVC5__OPTIONS__BASE_H */ |