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/base_options.h" |
19 |
|
|
20 |
|
#include <iostream> |
21 |
|
|
22 |
|
#include "base/check.h" |
23 |
|
#include "options/option_exception.h" |
24 |
|
|
25 |
|
// clang-format off |
26 |
|
namespace cvc5::options { |
27 |
|
|
28 |
|
std::ostream& operator<<(std::ostream& os, OutputTag mode) |
29 |
|
{ |
30 |
|
switch(mode) { |
31 |
|
case OutputTag::INST: |
32 |
|
return os << "OutputTag::INST"; |
33 |
|
case OutputTag::TRIGGER: |
34 |
|
return os << "OutputTag::TRIGGER"; |
35 |
|
case OutputTag::SYGUS: |
36 |
|
return os << "OutputTag::SYGUS"; |
37 |
|
default: |
38 |
|
Unreachable(); |
39 |
|
} |
40 |
|
return os; |
41 |
|
} |
42 |
3 |
OutputTag stringToOutputTag(const std::string& optarg) |
43 |
|
{ |
44 |
3 |
if (optarg == "inst") |
45 |
|
{ |
46 |
2 |
return OutputTag::INST; |
47 |
|
} |
48 |
1 |
else if (optarg == "trigger") |
49 |
|
{ |
50 |
|
return OutputTag::TRIGGER; |
51 |
|
} |
52 |
1 |
else if (optarg == "sygus") |
53 |
|
{ |
54 |
1 |
return OutputTag::SYGUS; |
55 |
|
} |
56 |
|
else if (optarg == "help") |
57 |
|
{ |
58 |
|
std::cerr << "Output tags.\n" |
59 |
|
"Available tags for --output are:\n" |
60 |
|
"+ inst\n" |
61 |
|
" print instantiations during solving\n" |
62 |
|
"+ trigger\n" |
63 |
|
" print selected triggers for quantified formulas\n" |
64 |
|
"+ sygus\n" |
65 |
|
" print enumerated terms and candidates generated by the sygus solver\n"; |
66 |
|
std::exit(1); |
67 |
|
} |
68 |
|
throw OptionException(std::string("unknown option for --output: `") + |
69 |
|
optarg + "'. Try --output=help."); |
70 |
|
} |
71 |
|
|
72 |
|
namespace base |
73 |
|
{ |
74 |
|
// clang-format off |
75 |
|
void setDefaultErr(Options& opts, ManagedErr value) |
76 |
|
{ |
77 |
|
if (!opts.base.errWasSetByUser) { |
78 |
|
opts.base.err = value; |
79 |
|
} |
80 |
|
} |
81 |
|
void setDefaultIn(Options& opts, ManagedIn value) |
82 |
|
{ |
83 |
|
if (!opts.base.inWasSetByUser) { |
84 |
|
opts.base.in = value; |
85 |
|
} |
86 |
|
} |
87 |
|
void setDefaultIncrementalSolving(Options& opts, bool value) |
88 |
|
{ |
89 |
|
if (!opts.base.incrementalSolvingWasSetByUser) { |
90 |
|
opts.base.incrementalSolving = value; |
91 |
|
} |
92 |
|
} |
93 |
|
void setDefaultInputLanguage(Options& opts, InputLanguage value) |
94 |
|
{ |
95 |
|
if (!opts.base.inputLanguageWasSetByUser) { |
96 |
|
opts.base.inputLanguage = value; |
97 |
|
} |
98 |
|
} |
99 |
|
void setDefaultLanguageHelp(Options& opts, bool value) |
100 |
|
{ |
101 |
|
if (!opts.base.languageHelpWasSetByUser) { |
102 |
|
opts.base.languageHelp = value; |
103 |
|
} |
104 |
|
} |
105 |
|
void setDefaultOut(Options& opts, ManagedOut value) |
106 |
|
{ |
107 |
|
if (!opts.base.outWasSetByUser) { |
108 |
|
opts.base.out = value; |
109 |
|
} |
110 |
|
} |
111 |
|
void setDefaultOutputLanguage(Options& opts, OutputLanguage value) |
112 |
|
{ |
113 |
|
if (!opts.base.outputLanguageWasSetByUser) { |
114 |
|
opts.base.outputLanguage = value; |
115 |
|
} |
116 |
|
} |
117 |
|
void setDefaultOutputTag(Options& opts, OutputTag value) |
118 |
|
{ |
119 |
|
if (!opts.base.outputTagWasSetByUser) { |
120 |
|
opts.base.outputTag = value; |
121 |
|
} |
122 |
|
} |
123 |
|
void setDefaultOutputTagHolder(Options& opts, std::bitset<OutputTag__numValues> value) |
124 |
|
{ |
125 |
|
if (!opts.base.outputTagHolderWasSetByUser) { |
126 |
|
opts.base.outputTagHolder = value; |
127 |
|
} |
128 |
|
} |
129 |
|
void setDefaultParseOnly(Options& opts, bool value) |
130 |
|
{ |
131 |
|
if (!opts.base.parseOnlyWasSetByUser) { |
132 |
|
opts.base.parseOnly = value; |
133 |
|
} |
134 |
|
} |
135 |
|
void setDefaultPreprocessOnly(Options& opts, bool value) |
136 |
|
{ |
137 |
|
if (!opts.base.preprocessOnlyWasSetByUser) { |
138 |
|
opts.base.preprocessOnly = value; |
139 |
|
} |
140 |
|
} |
141 |
|
void setDefaultPrintSuccess(Options& opts, bool value) |
142 |
|
{ |
143 |
|
if (!opts.base.printSuccessWasSetByUser) { |
144 |
|
opts.base.printSuccess = value; |
145 |
|
} |
146 |
|
} |
147 |
|
void setDefaultResourceWeightHolder(Options& opts, std::vector<std::string> value) |
148 |
|
{ |
149 |
|
if (!opts.base.resourceWeightHolderWasSetByUser) { |
150 |
|
opts.base.resourceWeightHolder = value; |
151 |
|
} |
152 |
|
} |
153 |
|
void setDefaultPerCallResourceLimit(Options& opts, uint64_t value) |
154 |
|
{ |
155 |
|
if (!opts.base.perCallResourceLimitWasSetByUser) { |
156 |
|
opts.base.perCallResourceLimit = value; |
157 |
|
} |
158 |
|
} |
159 |
|
void setDefaultCumulativeResourceLimit(Options& opts, uint64_t value) |
160 |
|
{ |
161 |
|
if (!opts.base.cumulativeResourceLimitWasSetByUser) { |
162 |
|
opts.base.cumulativeResourceLimit = value; |
163 |
|
} |
164 |
|
} |
165 |
|
void setDefaultStatistics(Options& opts, bool value) |
166 |
|
{ |
167 |
|
if (!opts.base.statisticsWasSetByUser) { |
168 |
|
opts.base.statistics = value; |
169 |
|
} |
170 |
|
} |
171 |
|
void setDefaultStatisticsAll(Options& opts, bool value) |
172 |
|
{ |
173 |
|
if (!opts.base.statisticsAllWasSetByUser) { |
174 |
|
opts.base.statisticsAll = value; |
175 |
|
} |
176 |
|
} |
177 |
|
void setDefaultStatisticsEveryQuery(Options& opts, bool value) |
178 |
|
{ |
179 |
|
if (!opts.base.statisticsEveryQueryWasSetByUser) { |
180 |
|
opts.base.statisticsEveryQuery = value; |
181 |
|
} |
182 |
|
} |
183 |
|
void setDefaultStatisticsExpert(Options& opts, bool value) |
184 |
|
{ |
185 |
|
if (!opts.base.statisticsExpertWasSetByUser) { |
186 |
|
opts.base.statisticsExpert = value; |
187 |
|
} |
188 |
|
} |
189 |
|
void setDefaultPerCallMillisecondLimit(Options& opts, uint64_t value) |
190 |
|
{ |
191 |
|
if (!opts.base.perCallMillisecondLimitWasSetByUser) { |
192 |
|
opts.base.perCallMillisecondLimit = value; |
193 |
|
} |
194 |
|
} |
195 |
|
void setDefaultCumulativeMillisecondLimit(Options& opts, uint64_t value) |
196 |
|
{ |
197 |
|
if (!opts.base.cumulativeMillisecondLimitWasSetByUser) { |
198 |
|
opts.base.cumulativeMillisecondLimit = value; |
199 |
|
} |
200 |
|
} |
201 |
|
void setDefaultVerbosity(Options& opts, int64_t value) |
202 |
|
{ |
203 |
|
if (!opts.base.verbosityWasSetByUser) { |
204 |
|
opts.base.verbosity = value; |
205 |
|
} |
206 |
|
} |
207 |
|
// clang-format on |
208 |
|
} |
209 |
|
|
210 |
29349 |
} // namespace cvc5::options |
211 |
|
// clang-format on |