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 { |
34 |
|
namespace options { |
35 |
|
|
36 |
|
// clang-format off |
37 |
|
|
38 |
|
enum class OutputTag |
39 |
|
{ |
40 |
|
INST, |
41 |
|
SYGUS, |
42 |
|
TRIGGER |
43 |
|
}; |
44 |
|
|
45 |
|
static constexpr size_t OutputTag__numValues = 3; |
46 |
|
|
47 |
|
std::ostream& operator<<(std::ostream& os, OutputTag mode); |
48 |
|
OutputTag stringToOutputTag(const std::string& optarg); |
49 |
|
// clang-format on |
50 |
|
|
51 |
|
#if defined(CVC5_MUZZLED) || defined(CVC5_COMPETITION_MODE) |
52 |
|
# define DO_SEMANTIC_CHECKS_BY_DEFAULT false |
53 |
|
#else /* CVC5_MUZZLED || CVC5_COMPETITION_MODE */ |
54 |
|
# define DO_SEMANTIC_CHECKS_BY_DEFAULT true |
55 |
|
#endif /* CVC5_MUZZLED || CVC5_COMPETITION_MODE */ |
56 |
|
|
57 |
69180 |
struct HolderBASE |
58 |
|
{ |
59 |
|
// clang-format off |
60 |
|
ManagedErr err; |
61 |
|
bool errWasSetByUser = false; |
62 |
|
ManagedIn in; |
63 |
|
bool inWasSetByUser = false; |
64 |
|
bool incrementalSolving = true; |
65 |
|
bool incrementalSolvingWasSetByUser = false; |
66 |
|
InputLanguage inputLanguage = language::input::LANG_AUTO; |
67 |
|
bool inputLanguageWasSetByUser = false; |
68 |
|
bool languageHelp; |
69 |
|
bool languageHelpWasSetByUser = false; |
70 |
|
ManagedOut out; |
71 |
|
bool outWasSetByUser = false; |
72 |
|
OutputLanguage outputLanguage = language::output::LANG_AUTO; |
73 |
|
bool outputLanguageWasSetByUser = false; |
74 |
|
OutputTag outputTag; |
75 |
|
bool outputTagWasSetByUser = false; |
76 |
|
std::bitset<OutputTag__numValues> outputTagHolder; |
77 |
|
bool outputTagHolderWasSetByUser = false; |
78 |
|
bool parseOnly; |
79 |
|
bool parseOnlyWasSetByUser = false; |
80 |
|
bool preprocessOnly; |
81 |
|
bool preprocessOnlyWasSetByUser = false; |
82 |
|
bool printSuccess; |
83 |
|
bool printSuccessWasSetByUser = false; |
84 |
|
std::vector<std::string> resourceWeightHolder; |
85 |
|
bool resourceWeightHolderWasSetByUser = false; |
86 |
|
uint64_t perCallResourceLimit; |
87 |
|
bool perCallResourceLimitWasSetByUser = false; |
88 |
|
uint64_t cumulativeResourceLimit; |
89 |
|
bool cumulativeResourceLimitWasSetByUser = false; |
90 |
|
bool statistics; |
91 |
|
bool statisticsWasSetByUser = false; |
92 |
|
bool statisticsAll; |
93 |
|
bool statisticsAllWasSetByUser = false; |
94 |
|
bool statisticsEveryQuery = false; |
95 |
|
bool statisticsEveryQueryWasSetByUser = false; |
96 |
|
bool statisticsExpert; |
97 |
|
bool statisticsExpertWasSetByUser = false; |
98 |
|
uint64_t perCallMillisecondLimit; |
99 |
|
bool perCallMillisecondLimitWasSetByUser = false; |
100 |
|
uint64_t cumulativeMillisecondLimit; |
101 |
|
bool cumulativeMillisecondLimitWasSetByUser = false; |
102 |
|
int64_t verbosity = 0; |
103 |
|
bool verbosityWasSetByUser = false; |
104 |
|
// clang-format on |
105 |
|
}; |
106 |
|
|
107 |
|
#undef DO_SEMANTIC_CHECKS_BY_DEFAULT |
108 |
|
|
109 |
|
// clang-format off |
110 |
|
extern struct err__option_t |
111 |
|
{ |
112 |
|
typedef ManagedErr type; |
113 |
|
type operator()() const; |
114 |
|
} thread_local err; |
115 |
|
extern struct in__option_t |
116 |
|
{ |
117 |
|
typedef ManagedIn type; |
118 |
|
type operator()() const; |
119 |
|
} thread_local in; |
120 |
|
extern struct incrementalSolving__option_t |
121 |
|
{ |
122 |
|
typedef bool type; |
123 |
|
type operator()() const; |
124 |
|
} thread_local incrementalSolving; |
125 |
|
extern struct inputLanguage__option_t |
126 |
|
{ |
127 |
|
typedef InputLanguage type; |
128 |
|
type operator()() const; |
129 |
|
} thread_local inputLanguage; |
130 |
|
extern struct languageHelp__option_t |
131 |
|
{ |
132 |
|
typedef bool type; |
133 |
|
type operator()() const; |
134 |
|
} thread_local languageHelp; |
135 |
|
extern struct out__option_t |
136 |
|
{ |
137 |
|
typedef ManagedOut type; |
138 |
|
type operator()() const; |
139 |
|
} thread_local out; |
140 |
|
extern struct outputLanguage__option_t |
141 |
|
{ |
142 |
|
typedef OutputLanguage type; |
143 |
|
type operator()() const; |
144 |
|
} thread_local outputLanguage; |
145 |
|
extern struct outputTag__option_t |
146 |
|
{ |
147 |
|
typedef OutputTag type; |
148 |
|
type operator()() const; |
149 |
|
} thread_local outputTag; |
150 |
|
extern struct outputTagHolder__option_t |
151 |
|
{ |
152 |
|
typedef std::bitset<OutputTag__numValues> type; |
153 |
|
type operator()() const; |
154 |
|
} thread_local outputTagHolder; |
155 |
|
extern struct parseOnly__option_t |
156 |
|
{ |
157 |
|
typedef bool type; |
158 |
|
type operator()() const; |
159 |
|
} thread_local parseOnly; |
160 |
|
extern struct preprocessOnly__option_t |
161 |
|
{ |
162 |
|
typedef bool type; |
163 |
|
type operator()() const; |
164 |
|
} thread_local preprocessOnly; |
165 |
|
extern struct printSuccess__option_t |
166 |
|
{ |
167 |
|
typedef bool type; |
168 |
|
type operator()() const; |
169 |
|
} thread_local printSuccess; |
170 |
|
extern struct resourceWeightHolder__option_t |
171 |
|
{ |
172 |
|
typedef std::vector<std::string> type; |
173 |
|
type operator()() const; |
174 |
|
} thread_local resourceWeightHolder; |
175 |
|
extern struct perCallResourceLimit__option_t |
176 |
|
{ |
177 |
|
typedef uint64_t type; |
178 |
|
type operator()() const; |
179 |
|
} thread_local perCallResourceLimit; |
180 |
|
extern struct cumulativeResourceLimit__option_t |
181 |
|
{ |
182 |
|
typedef uint64_t type; |
183 |
|
type operator()() const; |
184 |
|
} thread_local cumulativeResourceLimit; |
185 |
|
extern struct statistics__option_t |
186 |
|
{ |
187 |
|
typedef bool type; |
188 |
|
type operator()() const; |
189 |
|
} thread_local statistics; |
190 |
|
extern struct statisticsAll__option_t |
191 |
|
{ |
192 |
|
typedef bool type; |
193 |
|
type operator()() const; |
194 |
|
} thread_local statisticsAll; |
195 |
|
extern struct statisticsEveryQuery__option_t |
196 |
|
{ |
197 |
|
typedef bool type; |
198 |
|
type operator()() const; |
199 |
|
} thread_local statisticsEveryQuery; |
200 |
|
extern struct statisticsExpert__option_t |
201 |
|
{ |
202 |
|
typedef bool type; |
203 |
|
type operator()() const; |
204 |
|
} thread_local statisticsExpert; |
205 |
|
extern struct perCallMillisecondLimit__option_t |
206 |
|
{ |
207 |
|
typedef uint64_t type; |
208 |
|
type operator()() const; |
209 |
|
} thread_local perCallMillisecondLimit; |
210 |
|
extern struct cumulativeMillisecondLimit__option_t |
211 |
|
{ |
212 |
|
typedef uint64_t type; |
213 |
|
type operator()() const; |
214 |
|
} thread_local cumulativeMillisecondLimit; |
215 |
|
extern struct verbosity__option_t |
216 |
|
{ |
217 |
|
typedef int64_t type; |
218 |
|
type operator()() const; |
219 |
|
} thread_local verbosity; |
220 |
|
// clang-format on |
221 |
|
|
222 |
|
namespace base |
223 |
|
{ |
224 |
|
// clang-format off |
225 |
|
static constexpr const char* err__name = "err"; |
226 |
|
static constexpr const char* in__name = "in"; |
227 |
|
static constexpr const char* incrementalSolving__name = "incremental"; |
228 |
|
static constexpr const char* inputLanguage__name = "lang"; |
229 |
|
static constexpr const char* languageHelp__name = ""; |
230 |
|
static constexpr const char* out__name = "out"; |
231 |
|
static constexpr const char* outputLanguage__name = "output-lang"; |
232 |
|
static constexpr const char* outputTag__name = "output"; |
233 |
|
static constexpr const char* outputTagHolder__name = ""; |
234 |
|
static constexpr const char* parseOnly__name = "parse-only"; |
235 |
|
static constexpr const char* preprocessOnly__name = "preprocess-only"; |
236 |
|
static constexpr const char* printSuccess__name = "print-success"; |
237 |
|
static constexpr const char* resourceWeightHolder__name = ""; |
238 |
|
static constexpr const char* perCallResourceLimit__name = "rlimit-per"; |
239 |
|
static constexpr const char* cumulativeResourceLimit__name = "rlimit"; |
240 |
|
static constexpr const char* statistics__name = "stats"; |
241 |
|
static constexpr const char* statisticsAll__name = "stats-all"; |
242 |
|
static constexpr const char* statisticsEveryQuery__name = "stats-every-query"; |
243 |
|
static constexpr const char* statisticsExpert__name = "stats-expert"; |
244 |
|
static constexpr const char* perCallMillisecondLimit__name = "tlimit-per"; |
245 |
|
static constexpr const char* cumulativeMillisecondLimit__name = "tlimit"; |
246 |
|
static constexpr const char* verbosity__name = "verbosity"; |
247 |
|
// clang-format on |
248 |
|
} |
249 |
|
|
250 |
|
} // namespace options |
251 |
|
|
252 |
|
// clang-format off |
253 |
|
|
254 |
|
// clang-format on |
255 |
|
|
256 |
|
namespace options { |
257 |
|
// clang-format off |
258 |
|
inline ManagedErr err__option_t::operator()() const |
259 |
|
{ return Options::current().base.err; } |
260 |
|
inline ManagedIn in__option_t::operator()() const |
261 |
|
{ return Options::current().base.in; } |
262 |
9003867 |
inline bool incrementalSolving__option_t::operator()() const |
263 |
9003867 |
{ return Options::current().base.incrementalSolving; } |
264 |
99120 |
inline InputLanguage inputLanguage__option_t::operator()() const |
265 |
99120 |
{ return Options::current().base.inputLanguage; } |
266 |
|
inline bool languageHelp__option_t::operator()() const |
267 |
|
{ return Options::current().base.languageHelp; } |
268 |
|
inline ManagedOut out__option_t::operator()() const |
269 |
|
{ return Options::current().base.out; } |
270 |
43781 |
inline OutputLanguage outputLanguage__option_t::operator()() const |
271 |
43781 |
{ return Options::current().base.outputLanguage; } |
272 |
|
inline OutputTag outputTag__option_t::operator()() const |
273 |
|
{ return Options::current().base.outputTag; } |
274 |
67907 |
inline std::bitset<OutputTag__numValues> outputTagHolder__option_t::operator()() const |
275 |
67907 |
{ return Options::current().base.outputTagHolder; } |
276 |
|
inline bool parseOnly__option_t::operator()() const |
277 |
|
{ return Options::current().base.parseOnly; } |
278 |
15204 |
inline bool preprocessOnly__option_t::operator()() const |
279 |
15204 |
{ return Options::current().base.preprocessOnly; } |
280 |
|
inline bool printSuccess__option_t::operator()() const |
281 |
|
{ return Options::current().base.printSuccess; } |
282 |
|
inline std::vector<std::string> resourceWeightHolder__option_t::operator()() const |
283 |
|
{ return Options::current().base.resourceWeightHolder; } |
284 |
|
inline uint64_t perCallResourceLimit__option_t::operator()() const |
285 |
|
{ return Options::current().base.perCallResourceLimit; } |
286 |
|
inline uint64_t cumulativeResourceLimit__option_t::operator()() const |
287 |
|
{ return Options::current().base.cumulativeResourceLimit; } |
288 |
|
inline bool statistics__option_t::operator()() const |
289 |
|
{ return Options::current().base.statistics; } |
290 |
|
inline bool statisticsAll__option_t::operator()() const |
291 |
|
{ return Options::current().base.statisticsAll; } |
292 |
|
inline bool statisticsEveryQuery__option_t::operator()() const |
293 |
|
{ return Options::current().base.statisticsEveryQuery; } |
294 |
|
inline bool statisticsExpert__option_t::operator()() const |
295 |
|
{ return Options::current().base.statisticsExpert; } |
296 |
|
inline uint64_t perCallMillisecondLimit__option_t::operator()() const |
297 |
|
{ return Options::current().base.perCallMillisecondLimit; } |
298 |
|
inline uint64_t cumulativeMillisecondLimit__option_t::operator()() const |
299 |
|
{ return Options::current().base.cumulativeMillisecondLimit; } |
300 |
15201 |
inline int64_t verbosity__option_t::operator()() const |
301 |
15201 |
{ return Options::current().base.verbosity; } |
302 |
|
// clang-format on |
303 |
|
|
304 |
|
namespace base |
305 |
|
{ |
306 |
|
// clang-format off |
307 |
|
void setDefaultErr(Options& opts, ManagedErr value); |
308 |
|
void setDefaultIn(Options& opts, ManagedIn value); |
309 |
|
void setDefaultIncrementalSolving(Options& opts, bool value); |
310 |
|
void setDefaultInputLanguage(Options& opts, InputLanguage value); |
311 |
|
void setDefaultLanguageHelp(Options& opts, bool value); |
312 |
|
void setDefaultOut(Options& opts, ManagedOut value); |
313 |
|
void setDefaultOutputLanguage(Options& opts, OutputLanguage value); |
314 |
|
void setDefaultOutputTag(Options& opts, OutputTag value); |
315 |
|
void setDefaultOutputTagHolder(Options& opts, std::bitset<OutputTag__numValues> value); |
316 |
|
void setDefaultParseOnly(Options& opts, bool value); |
317 |
|
void setDefaultPreprocessOnly(Options& opts, bool value); |
318 |
|
void setDefaultPrintSuccess(Options& opts, bool value); |
319 |
|
void setDefaultResourceWeightHolder(Options& opts, std::vector<std::string> value); |
320 |
|
void setDefaultPerCallResourceLimit(Options& opts, uint64_t value); |
321 |
|
void setDefaultCumulativeResourceLimit(Options& opts, uint64_t value); |
322 |
|
void setDefaultStatistics(Options& opts, bool value); |
323 |
|
void setDefaultStatisticsAll(Options& opts, bool value); |
324 |
|
void setDefaultStatisticsEveryQuery(Options& opts, bool value); |
325 |
|
void setDefaultStatisticsExpert(Options& opts, bool value); |
326 |
|
void setDefaultPerCallMillisecondLimit(Options& opts, uint64_t value); |
327 |
|
void setDefaultCumulativeMillisecondLimit(Options& opts, uint64_t value); |
328 |
|
void setDefaultVerbosity(Options& opts, int64_t value); |
329 |
|
// clang-format on |
330 |
|
} |
331 |
|
|
332 |
|
} // namespace options |
333 |
|
} // namespace cvc5 |
334 |
|
|
335 |
|
#endif /* CVC5__OPTIONS__BASE_H */ |