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 <bitset> |
29 |
|
#include <iostream> |
30 |
|
// clang-format on |
31 |
|
|
32 |
|
namespace cvc5 { |
33 |
|
namespace options { |
34 |
|
|
35 |
|
// clang-format off |
36 |
|
|
37 |
|
enum class OutputTag |
38 |
|
{ |
39 |
|
INST, |
40 |
|
SYGUS, |
41 |
|
TRIGGER |
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 |
69184 |
struct HolderBASE |
57 |
|
{ |
58 |
|
// clang-format off |
59 |
|
std::ostream* err = &std::cerr; |
60 |
|
bool errWasSetByUser = false; |
61 |
|
std::istream* in = &std::cin; |
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 |
|
std::ostream* out = &std::cout; |
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 |
|
extern struct err__option_t |
110 |
|
{ |
111 |
|
typedef std::ostream* type; |
112 |
|
type operator()() const; |
113 |
|
} thread_local err; |
114 |
|
extern struct in__option_t |
115 |
|
{ |
116 |
|
typedef std::istream* type; |
117 |
|
type operator()() const; |
118 |
|
} thread_local in; |
119 |
|
extern struct incrementalSolving__option_t |
120 |
|
{ |
121 |
|
typedef bool type; |
122 |
|
type operator()() const; |
123 |
|
} thread_local incrementalSolving; |
124 |
|
extern struct inputLanguage__option_t |
125 |
|
{ |
126 |
|
typedef InputLanguage type; |
127 |
|
type operator()() const; |
128 |
|
} thread_local inputLanguage; |
129 |
|
extern struct languageHelp__option_t |
130 |
|
{ |
131 |
|
typedef bool type; |
132 |
|
type operator()() const; |
133 |
|
} thread_local languageHelp; |
134 |
|
extern struct out__option_t |
135 |
|
{ |
136 |
|
typedef std::ostream* type; |
137 |
|
type operator()() const; |
138 |
|
} thread_local out; |
139 |
|
extern struct outputLanguage__option_t |
140 |
|
{ |
141 |
|
typedef OutputLanguage type; |
142 |
|
type operator()() const; |
143 |
|
} thread_local outputLanguage; |
144 |
|
extern struct outputTag__option_t |
145 |
|
{ |
146 |
|
typedef OutputTag type; |
147 |
|
type operator()() const; |
148 |
|
} thread_local outputTag; |
149 |
|
extern struct outputTagHolder__option_t |
150 |
|
{ |
151 |
|
typedef std::bitset<OutputTag__numValues> type; |
152 |
|
type operator()() const; |
153 |
|
} thread_local outputTagHolder; |
154 |
|
extern struct parseOnly__option_t |
155 |
|
{ |
156 |
|
typedef bool type; |
157 |
|
type operator()() const; |
158 |
|
} thread_local parseOnly; |
159 |
|
extern struct preprocessOnly__option_t |
160 |
|
{ |
161 |
|
typedef bool type; |
162 |
|
type operator()() const; |
163 |
|
} thread_local preprocessOnly; |
164 |
|
extern struct printSuccess__option_t |
165 |
|
{ |
166 |
|
typedef bool type; |
167 |
|
type operator()() const; |
168 |
|
} thread_local printSuccess; |
169 |
|
extern struct resourceWeightHolder__option_t |
170 |
|
{ |
171 |
|
typedef std::vector<std::string> type; |
172 |
|
type operator()() const; |
173 |
|
} thread_local resourceWeightHolder; |
174 |
|
extern struct perCallResourceLimit__option_t |
175 |
|
{ |
176 |
|
typedef uint64_t type; |
177 |
|
type operator()() const; |
178 |
|
} thread_local perCallResourceLimit; |
179 |
|
extern struct cumulativeResourceLimit__option_t |
180 |
|
{ |
181 |
|
typedef uint64_t type; |
182 |
|
type operator()() const; |
183 |
|
} thread_local cumulativeResourceLimit; |
184 |
|
extern struct statistics__option_t |
185 |
|
{ |
186 |
|
typedef bool type; |
187 |
|
type operator()() const; |
188 |
|
} thread_local statistics; |
189 |
|
extern struct statisticsAll__option_t |
190 |
|
{ |
191 |
|
typedef bool type; |
192 |
|
type operator()() const; |
193 |
|
} thread_local statisticsAll; |
194 |
|
extern struct statisticsEveryQuery__option_t |
195 |
|
{ |
196 |
|
typedef bool type; |
197 |
|
type operator()() const; |
198 |
|
} thread_local statisticsEveryQuery; |
199 |
|
extern struct statisticsExpert__option_t |
200 |
|
{ |
201 |
|
typedef bool type; |
202 |
|
type operator()() const; |
203 |
|
} thread_local statisticsExpert; |
204 |
|
extern struct perCallMillisecondLimit__option_t |
205 |
|
{ |
206 |
|
typedef uint64_t type; |
207 |
|
type operator()() const; |
208 |
|
} thread_local perCallMillisecondLimit; |
209 |
|
extern struct cumulativeMillisecondLimit__option_t |
210 |
|
{ |
211 |
|
typedef uint64_t type; |
212 |
|
type operator()() const; |
213 |
|
} thread_local cumulativeMillisecondLimit; |
214 |
|
extern struct verbosity__option_t |
215 |
|
{ |
216 |
|
typedef int64_t type; |
217 |
|
type operator()() const; |
218 |
|
} thread_local verbosity; |
219 |
|
// clang-format on |
220 |
|
|
221 |
|
namespace base |
222 |
|
{ |
223 |
|
// clang-format off |
224 |
|
static constexpr const char* err__name = ""; |
225 |
|
static constexpr const char* in__name = ""; |
226 |
|
static constexpr const char* incrementalSolving__name = "incremental"; |
227 |
|
static constexpr const char* inputLanguage__name = "lang"; |
228 |
|
static constexpr const char* languageHelp__name = ""; |
229 |
|
static constexpr const char* out__name = ""; |
230 |
|
static constexpr const char* outputLanguage__name = "output-lang"; |
231 |
|
static constexpr const char* outputTag__name = "output"; |
232 |
|
static constexpr const char* outputTagHolder__name = ""; |
233 |
|
static constexpr const char* parseOnly__name = "parse-only"; |
234 |
|
static constexpr const char* preprocessOnly__name = "preprocess-only"; |
235 |
|
static constexpr const char* printSuccess__name = "print-success"; |
236 |
|
static constexpr const char* resourceWeightHolder__name = ""; |
237 |
|
static constexpr const char* perCallResourceLimit__name = "rlimit-per"; |
238 |
|
static constexpr const char* cumulativeResourceLimit__name = "rlimit"; |
239 |
|
static constexpr const char* statistics__name = "stats"; |
240 |
|
static constexpr const char* statisticsAll__name = "stats-all"; |
241 |
|
static constexpr const char* statisticsEveryQuery__name = "stats-every-query"; |
242 |
|
static constexpr const char* statisticsExpert__name = "stats-expert"; |
243 |
|
static constexpr const char* perCallMillisecondLimit__name = "tlimit-per"; |
244 |
|
static constexpr const char* cumulativeMillisecondLimit__name = "tlimit"; |
245 |
|
static constexpr const char* verbosity__name = "verbosity"; |
246 |
|
// clang-format on |
247 |
|
} |
248 |
|
|
249 |
|
} // namespace options |
250 |
|
|
251 |
|
// clang-format off |
252 |
|
|
253 |
|
// clang-format on |
254 |
|
|
255 |
|
namespace options { |
256 |
|
// clang-format off |
257 |
20968 |
inline std::ostream* err__option_t::operator()() const |
258 |
20968 |
{ return Options::current().base.err; } |
259 |
|
inline std::istream* in__option_t::operator()() const |
260 |
|
{ return Options::current().base.in; } |
261 |
8958927 |
inline bool incrementalSolving__option_t::operator()() const |
262 |
8958927 |
{ return Options::current().base.incrementalSolving; } |
263 |
99649 |
inline InputLanguage inputLanguage__option_t::operator()() const |
264 |
99649 |
{ return Options::current().base.inputLanguage; } |
265 |
|
inline bool languageHelp__option_t::operator()() const |
266 |
|
{ return Options::current().base.languageHelp; } |
267 |
37 |
inline std::ostream* out__option_t::operator()() const |
268 |
37 |
{ return Options::current().base.out; } |
269 |
43769 |
inline OutputLanguage outputLanguage__option_t::operator()() const |
270 |
43769 |
{ return Options::current().base.outputLanguage; } |
271 |
|
inline OutputTag outputTag__option_t::operator()() const |
272 |
|
{ return Options::current().base.outputTag; } |
273 |
67912 |
inline std::bitset<OutputTag__numValues> outputTagHolder__option_t::operator()() const |
274 |
67912 |
{ return Options::current().base.outputTagHolder; } |
275 |
|
inline bool parseOnly__option_t::operator()() const |
276 |
|
{ return Options::current().base.parseOnly; } |
277 |
15192 |
inline bool preprocessOnly__option_t::operator()() const |
278 |
15192 |
{ return Options::current().base.preprocessOnly; } |
279 |
|
inline bool printSuccess__option_t::operator()() const |
280 |
|
{ return Options::current().base.printSuccess; } |
281 |
|
inline std::vector<std::string> resourceWeightHolder__option_t::operator()() const |
282 |
|
{ return Options::current().base.resourceWeightHolder; } |
283 |
|
inline uint64_t perCallResourceLimit__option_t::operator()() const |
284 |
|
{ return Options::current().base.perCallResourceLimit; } |
285 |
|
inline uint64_t cumulativeResourceLimit__option_t::operator()() const |
286 |
|
{ return Options::current().base.cumulativeResourceLimit; } |
287 |
|
inline bool statistics__option_t::operator()() const |
288 |
|
{ return Options::current().base.statistics; } |
289 |
|
inline bool statisticsAll__option_t::operator()() const |
290 |
|
{ return Options::current().base.statisticsAll; } |
291 |
|
inline bool statisticsEveryQuery__option_t::operator()() const |
292 |
|
{ return Options::current().base.statisticsEveryQuery; } |
293 |
|
inline bool statisticsExpert__option_t::operator()() const |
294 |
|
{ return Options::current().base.statisticsExpert; } |
295 |
|
inline uint64_t perCallMillisecondLimit__option_t::operator()() const |
296 |
|
{ return Options::current().base.perCallMillisecondLimit; } |
297 |
|
inline uint64_t cumulativeMillisecondLimit__option_t::operator()() const |
298 |
|
{ return Options::current().base.cumulativeMillisecondLimit; } |
299 |
15189 |
inline int64_t verbosity__option_t::operator()() const |
300 |
15189 |
{ return Options::current().base.verbosity; } |
301 |
|
// clang-format on |
302 |
|
|
303 |
|
namespace base |
304 |
|
{ |
305 |
|
// clang-format off |
306 |
|
void setDefaultErr(Options& opts, std::ostream* value); |
307 |
|
void setDefaultIn(Options& opts, std::istream* value); |
308 |
|
void setDefaultIncrementalSolving(Options& opts, bool value); |
309 |
|
void setDefaultInputLanguage(Options& opts, InputLanguage value); |
310 |
|
void setDefaultLanguageHelp(Options& opts, bool value); |
311 |
|
void setDefaultOut(Options& opts, std::ostream* value); |
312 |
|
void setDefaultOutputLanguage(Options& opts, OutputLanguage value); |
313 |
|
void setDefaultOutputTag(Options& opts, OutputTag value); |
314 |
|
void setDefaultOutputTagHolder(Options& opts, std::bitset<OutputTag__numValues> value); |
315 |
|
void setDefaultParseOnly(Options& opts, bool value); |
316 |
|
void setDefaultPreprocessOnly(Options& opts, bool value); |
317 |
|
void setDefaultPrintSuccess(Options& opts, bool value); |
318 |
|
void setDefaultResourceWeightHolder(Options& opts, std::vector<std::string> value); |
319 |
|
void setDefaultPerCallResourceLimit(Options& opts, uint64_t value); |
320 |
|
void setDefaultCumulativeResourceLimit(Options& opts, uint64_t value); |
321 |
|
void setDefaultStatistics(Options& opts, bool value); |
322 |
|
void setDefaultStatisticsAll(Options& opts, bool value); |
323 |
|
void setDefaultStatisticsEveryQuery(Options& opts, bool value); |
324 |
|
void setDefaultStatisticsExpert(Options& opts, bool value); |
325 |
|
void setDefaultPerCallMillisecondLimit(Options& opts, uint64_t value); |
326 |
|
void setDefaultCumulativeMillisecondLimit(Options& opts, uint64_t value); |
327 |
|
void setDefaultVerbosity(Options& opts, int64_t value); |
328 |
|
// clang-format on |
329 |
|
} |
330 |
|
|
331 |
|
} // namespace options |
332 |
|
} // namespace cvc5 |
333 |
|
|
334 |
|
#endif /* CVC5__OPTIONS__BASE_H */ |