forked from Z3Prover/z3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgparams.cpp
666 lines (588 loc) · 24.9 KB
/
gparams.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
/*++
Copyright (c) 2012 Microsoft Corporation
Module Name:
gparams.cpp
Abstract:
Global parameter management.
Author:
Leonardo (leonardo) 2012-11-29
Notes:
--*/
#include "util/gparams.h"
#include "util/str_hashtable.h"
#include "util/trace.h"
#include "util/mutex.h"
#include "util/region.h"
#include "util/map.h"
static DECLARE_MUTEX(gparams_mux);
extern void gparams_register_modules();
static char const * g_old_params_names[] = {
"arith_adaptive","arith_adaptive_assertion_threshold","arith_adaptive_gcd","arith_adaptive_propagation_threshold","arith_add_binary_bounds","arith_blands_rule_threshold","arith_branch_cut_ratio","arith_dump_lemmas","arith_eager_eq_axioms","arith_eager_gcd","arith_eq_bounds","arith_euclidean_solver","arith_expand_eqs","arith_force_simplex","arith_gcd_test","arith_ignore_int","arith_lazy_adapter","arith_lazy_pivoting","arith_max_lemma_size","arith_process_all_eqs","arith_propagate_eqs","arith_propagation_mode","arith_propagation_threshold","arith_prop_strategy","arith_random_initial_value","arith_random_lower","arith_random_seed","arith_random_upper","arith_reflect","arith_skip_big_coeffs","arith_small_lemma_size","arith_solver","arith_stronger_lemmas","array_always_prop_upward","array_canonize","array_cg","array_delay_exp_axiom","array_extensional","array_laziness","array_lazy_ieq","array_lazy_ieq_delay","array_solver","array_weak","async_commands","at_labels_cex","auto_config","bb_eager","bb_ext_gates","bb_quantifiers","bin_clauses","bit2int","bv2int_distribute","bv_blast_max_size","bv_cc","bv_enable_int2bv_propagation","bv_lazy_le","bv_max_sharing","bv_reflect","bv_solver","case_split","check_at_labels","check_proof","cnf_factor","cnf_mode","context_simplifier","dack","dack_eq","dack_factor","dack_gc","dack_gc_inv_decay","dack_threshold","default_qid","default_table","default_table_checked","delay_units","delay_units_threshold","der","display_config","display_dot_proof","display_error_for_visual_studio","display_features","display_proof","display_unsat_core","distribute_forall","dt_lazy_splits","dump_goal_as_smt","elim_and","elim_bounds","elim_nlarith_quantifiers","elim_quantifiers","elim_term_ite","ematching","engine","eq_propagation","hi_div0","ignore_bad_patterns","ignore_setparameter","instruction_max","inst_gen","interactive","internalizer_nnf","lemma_gc_factor","lemma_gc_half","lemma_gc_initial","lemma_gc_new_clause_activity","lemma_gc_new_clause_relevancy","lemma_gc_new_old_ratio","lemma_gc_old_clause_activity","lemma_gc_old_clause_relevancy","lemma_gc_strategy","lift_ite","lookahead_diseq","macro_finder","max_conflicts","max_counterexamples","mbqi","mbqi_force_template","mbqi_max_cexs","mbqi_max_cexs_incr","mbqi_max_iterations","mbqi_trace","minimize_lemmas","model","model_compact","model_completion","model_display_arg_sort","model_hide_unused_partitions","model_on_final_check","model_on_timeout","model_partial","model_v1","model_v2","model_validate","new_core2th_eq","ng_lift_ite","nl_arith","nl_arith_branching","nl_arith_gb","nl_arith_gb_eqs","nl_arith_gb_perturbate","nl_arith_gb_threshold","nl_arith_max_degree","nl_arith_rounds","nnf_factor","nnf_ignore_labels","nnf_mode","nnf_sk_hack","order","order_var_weight","order_weights","phase_selection","pi_arith","pi_arith_weight","pi_avoid_skolems","pi_block_looop_patterns","pi_max_multi_patterns","pi_non_nested_arith_weight","pi_nopat_weight","pi_pull_quantifiers","pi_use_database","pi_warnings","pp_bounded","pp_bv_literals","pp_bv_neg","pp_decimal","pp_decimal_precision","pp_fixed_indent","pp_flat_assoc","pp_max_depth","pp_max_indent","pp_max_num_lines","pp_max_ribbon","pp_max_width","pp_min_alias_size","pp_simplify_implies","pp_single_line","precedence","precedence_gen","pre_demodulator","pre_simplifier","pre_simplify_expr","profile_res_sub","progress_sampling_freq","proof_mode","propagate_booleans","propagate_values","pull_cheap_ite_trees","pull_nested_quantifiers","qi_conservative_final_check","qi_cost","qi_eager_threshold","qi_lazy_instantiation","qi_lazy_quick_checker","qi_lazy_threshold","qi_max_eager_multi_patterns","qi_max_instances","qi_max_lazy_multi_pattern_matching","qi_new_gen","qi_profile","qi_profile_freq","qi_promote_unsat","qi_quick_checker","quasi_macros","random_case_split_freq","random_initial_activity","random_seed","recent_lemma_threshold","reduce_args","refine_inj_axiom","relevancy","relevancy_lemma","rel_case_split_order","restart_adaptive","restart_agility_threshold","restart_factor","restart_initial","restart_strategy","restricted_quasi_macros","simplify_clauses","smtlib2_compliant","smtlib_category","smtlib_dump_lemmas","smtlib_logic","smtlib_source_info","smtlib_trace_path","soft_timeout","solver","spc_bs","spc_es","spc_factor_subsumption_index_opt","spc_initial_subsumption_index_opt","spc_max_subsumption_index_features","spc_min_func_freq_subsumption_index","spc_num_iterations","spc_trace","statistics","strong_context_simplifier","tick","trace","trace_file_name","type_check","user_theory_persist_axioms","user_theory_preprocess_axioms","verbose","warning","well_sorted_check","z3_solver_ll_pp","z3_solver_smt_pp", nullptr };
static bool is_old_param_name(std::string const & name) {
char const * const * it = g_old_params_names;
while (*it) {
if (name == *it)
return true;
it++;
}
return false;
}
static char const * g_params_renames[] = {
"proof_mode", "proof",
"soft_timeout", "timeout",
"mbqi", "smt.mbqi",
"relevancy", "smt.relevancy",
"ematching", "smt.ematching",
"macro_finder", "smt.macro_finder",
"delay_units", "smt.delay_units",
"case_split", "smt.case_split",
"phase_selection", "smt.phase_selection",
"restart_strategy", "smt.restart_strategy",
"restart_factor", "smt.restart_factor",
"arith_random_initial_value", "smt.arith.random_initial_value",
"bv_reflect", "smt.bv.reflect",
"bv_enable_int2bv_propagation", "smt.bv.enable_int2bv",
"qi_cost", "smt.qi.cost",
"qi_eager_threshold", "smt.qi.eager_threshold",
"nl_arith", "smt.arith.nl",
"pull_nested_quantifiers", "smt.pull_nested_quantifiers",
"nnf_sk_hack", "nnf.sk_hack",
"model_v2", "model.v2",
"pi_non_nested_arith_weight", "pi.non_nested_arith_weight",
"pi_warnings", "pi.warnings",
"pp_decimal", "pp.decimal",
"pp_decimal", "pp.decimal_precision",
"pp_bv_literals", "pp.bv_literals",
"pp_bv_neg", "pp.bv_neg",
"pp_max_depth", "pp.max_depth",
"pp_min_alias_size", "pp.min_alias_size",
nullptr };
static char const * get_new_param_name(std::string const & p) {
char const * const * it = g_params_renames;
while (*it) {
if (p == *it) {
it++;
return *it;
}
it += 2;
}
return nullptr;
}
template <typename T>
class smap : public map<char const*, T, str_hash_proc, str_eq_proc> {};
typedef param_descrs* (*lazy_descrs_t)(void);
class lazy_param_descrs {
param_descrs* m_descrs;
svector<lazy_descrs_t> m_mk;
void apply(lazy_descrs_t f) {
param_descrs* d = f();
if (m_descrs) {
m_descrs->copy(*d);
dealloc(d);
}
else {
m_descrs = d;
}
}
void reset_mk() {
m_mk.reset();
}
public:
lazy_param_descrs(lazy_descrs_t f): m_descrs(nullptr) {
append(f);
}
~lazy_param_descrs() {
dealloc(m_descrs);
}
param_descrs* deref() {
for (auto* f : m_mk) apply(*f);
reset_mk();
return m_descrs;
}
void append(lazy_descrs_t f) {
m_mk.push_back(f);
}
};
struct gparams::imp {
bool m_modules_registered;
smap<lazy_param_descrs*> m_module_param_descrs;
smap<char const *> m_module_descrs;
param_descrs m_param_descrs;
smap<params_ref* > m_module_params;
params_ref m_params;
region m_region;
std::string m_buffer;
void check_registered() {
if (m_modules_registered)
return;
m_modules_registered = true;
gparams_register_modules();
}
smap<lazy_param_descrs*> & get_module_param_descrs() {
check_registered(); return m_module_param_descrs;
}
smap<char const *> & get_module_descrs() { check_registered(); return m_module_descrs; }
param_descrs & get_param_descrs() { check_registered(); return m_param_descrs; }
char * cpy(char const* s) {
char * r = new (m_region) char[strlen(s)+1];
memcpy(r, s, strlen(s)+1);
return r;
}
bool get_module_param_descr(std::string const& m, param_descrs*& d) {
return get_module_param_descr(m.c_str(), d);
}
bool get_module_param_descr(char const* m, param_descrs*& d) {
check_registered();
lazy_param_descrs* ld;
return m_module_param_descrs.find(m, ld) && (d = ld->deref(), true);
}
public:
imp():
m_modules_registered(false) {
}
~imp() {
reset();
for (auto & kv : m_module_param_descrs) {
dealloc(kv.m_value);
}
}
void reset() {
lock_guard lock(*gparams_mux);
m_params.reset();
for (auto & kv : m_module_params) {
dealloc(kv.m_value);
}
m_module_params.reset();
m_region.reset();
}
// -----------------------------------------------
//
// Module registration routines.
// They are invoked when descriptions are initialized
//
// -----------------------------------------------
void register_global(param_descrs & d) {
// Don't need synchronization here, this method
// is invoked from check_registered that is already protected.
m_param_descrs.copy(d);
}
void register_module(char const * module_name, lazy_descrs_t f) {
// Don't need synchronization here, this method
// is invoked from check_registered that is already protected.
lazy_param_descrs * ld;
if (m_module_param_descrs.find(module_name, ld)) {
ld->append(f);
}
else {
ld = alloc(lazy_param_descrs, f);
m_module_param_descrs.insert(cpy(module_name), ld);
}
}
void register_module_descr(char const * module_name, char const * descr) {
// Don't need synchronization here, this method
// is invoked from check_registered that is already protected.
if (!m_module_descrs.contains(module_name)) {
m_module_descrs.insert(cpy(module_name), descr);
}
}
// -----------------------------------------------
//
// Parameter setting & retrieval
//
// -----------------------------------------------
void normalize(char const * name, /* out */ std::string & mod_name, /* out */ std::string & param_name) {
if (*name == ':')
name++;
std::string tmp = name;
unsigned n = static_cast<unsigned>(tmp.size());
for (unsigned i = 0; i < n; i++) {
if (tmp[i] >= 'A' && tmp[i] <= 'Z')
tmp[i] = tmp[i] - 'A' + 'a';
else if (tmp[i] == '-')
tmp[i] = '_';
}
for (unsigned i = 0; i < n; i++) {
if (tmp[i] == '.') {
param_name = tmp.c_str() + i + 1;
tmp.resize(i);
mod_name = tmp;
return;
}
}
param_name = tmp;
mod_name = "";
}
params_ref & get_params(std::string const& mod_name) {
if (!mod_name[0]) {
return m_params;
}
else {
params_ref * p = nullptr;
if (!m_module_params.find(mod_name.c_str(), p)) {
p = alloc(params_ref);
m_module_params.insert(cpy(mod_name.c_str()), p);
}
SASSERT(p);
return *p;
}
}
void throw_unknown_parameter(std::string const& param_name, param_descrs const& d, std::string const& mod_name) {
if (!mod_name[0]) {
char const * new_name = get_new_param_name(param_name);
if (new_name) {
std::stringstream strm;
strm << "the parameter '" << param_name
<< "', invoke 'z3 -p' to obtain the new parameter list, and 'z3 -pp:" << new_name
<< "' for the full description of the parameter";
throw exception(std::move(strm).str());
}
else if (is_old_param_name(param_name)) {
std::stringstream strm;
strm << "unknown parameter '" << param_name
<< "', this is an old parameter name, invoke 'z3 -p' to obtain the new parameter list";
throw default_exception(std::move(strm).str());
}
else {
std::stringstream strm;
strm << "unknown parameter '" << param_name << "'\n";
strm << "Legal parameters are:\n";
d.display(strm, 2, false, false);
throw default_exception(std::move(strm).str());
}
}
else {
std::stringstream strm;
strm << "unknown parameter '" << param_name << "' ";
strm << "at module '" << mod_name << "'\n";
strm << "Legal parameters are:\n";
d.display(strm, 2, false, false);
throw default_exception(std::move(strm).str());
}
}
void validate_type(std::string& name, char const* value, param_descrs const& d) {
param_kind k = d.get_kind(name.c_str());
std::stringstream strm;
char const* _value = value;
switch (k) {
case CPK_UINT:
for (; *value; ++value) {
if (!('0' <= *value && *value <= '9')) {
strm << "Expected values for parameter " << name
<< " is an unsigned integer. It was given argument '" << _value << "'";
throw default_exception(std::move(strm).str());
}
}
break;
case CPK_DOUBLE:
for (; *value; ++value) {
if (!('0' <= *value && *value <= '9') && *value != '.' && *value != '-' && *value != '/') {
strm << "Expected values for parameter " << name
<< " is a double. It was given argument '" << _value << "'";
throw default_exception(std::move(strm).str());
}
}
break;
case CPK_BOOL:
if (strcmp(value, "true") != 0 && strcmp(value, "false") != 0) {
strm << "Expected values for parameter " << name
<< " are 'true' or 'false'. It was given argument '" << value << "'";
throw default_exception(std::move(strm).str());
}
break;
default:
break;
}
}
void set(param_descrs const & d, std::string const & _param_name, char const * value, std::string const & mod_name) {
char const* param_name = _param_name.c_str();
param_kind k = d.get_kind(param_name);
params_ref & ps = get_params(mod_name);
if (k == CPK_INVALID) {
throw_unknown_parameter(_param_name, d, mod_name);
}
else if (k == CPK_UINT) {
long val = strtol(value, nullptr, 10);
ps.set_uint(param_name, static_cast<unsigned>(val));
}
else if (k == CPK_DOUBLE) {
char * aux;
double val = strtod(value, &aux);
ps.set_double(param_name, val);
}
else if (k == CPK_BOOL) {
if (strcmp(value, "true") == 0) {
ps.set_bool(param_name, true);
}
else if (strcmp(value, "false") == 0) {
ps.set_bool(param_name, false);
}
else {
std::stringstream strm;
strm << "invalid value '" << value << "' for Boolean parameter '" << param_name << "'";
if (mod_name[0]) {
strm << " at module '" << mod_name << "'";
}
throw default_exception(std::move(strm).str());
}
}
else if (k == CPK_SYMBOL) {
ps.set_sym(param_name, symbol(value));
}
else if (k == CPK_STRING) {
// There is no guarantee that (external) callers will not delete value after invoking gparams::set.
// the value is copied to internal region.
ps.set_str(param_name, cpy(value));
}
else {
std::stringstream strm;
strm << "unsupported parameter type '" << param_name << "'";
if (mod_name[0]) {
strm << " at module '" << mod_name << "'";
}
throw exception(std::move(strm).str());
}
}
void set(char const * name, char const * value) {
std::string m, p;
normalize(name, m, p);
lock_guard lock(*gparams_mux);
if (!m[0]) {
validate_type(p, value, get_param_descrs());
set(get_param_descrs(), p, value, m);
}
else {
param_descrs * d;
if (get_module_param_descr(m, d)) {
validate_type(p, value, *d);
set(*d, p, value, m);
}
else {
std::stringstream strm;
strm << "invalid parameter, unknown module '" << m << "'";
throw exception(std::move(strm).str());
}
}
}
std::string get_value(params_ref const & ps, std::string const & p) {
symbol sp(p.c_str());
std::ostringstream buffer;
ps.display(buffer, sp);
return buffer.str();
}
std::string get_default(param_descrs const & d, std::string const & p, std::string const & m) {
symbol sp(p.c_str());
if (!d.contains(sp)) {
throw_unknown_parameter(p, d, m);
}
char const * r = d.get_default(sp);
if (r == nullptr)
return "default";
return r;
}
std::string get_value(char const * name) {
std::string m, p;
normalize(name, m, p);
lock_guard lock(*gparams_mux);
symbol sp(p.c_str());
if (!m[0]) {
if (m_params.contains(sp)) {
return get_value(m_params, p);
}
else {
return get_default(get_param_descrs(), p, m);
}
}
else {
params_ref * ps = nullptr;
if (m_module_params.find(m.c_str(), ps) && ps->contains(sp)) {
return get_value(*ps, p);
}
else {
param_descrs * d;
if (get_module_param_descr(m, d)) {
return get_default(*d, p, m);
}
}
}
std::stringstream strm;
strm << "unknown module '" << m << "'";
throw exception(std::move(strm).str());
}
// unfortunately, params_ref is not thread safe
// so better create a local copy of the parameters.
params_ref get_module(char const* module_name) {
params_ref result;
params_ref * ps = nullptr;
{
lock_guard lock(*gparams_mux);
if (m_module_params.find(module_name, ps)) {
result.copy(*ps);
}
}
return result;
}
params_ref const& get_ref() {
return m_params;
}
// -----------------------------------------------
//
// Pretty printing
//
// -----------------------------------------------
void display(std::ostream & out, unsigned indent, bool smt2_style, bool include_descr) {
lock_guard lock(*gparams_mux);
out << "Global parameters\n";
get_param_descrs().display(out, indent + 4, smt2_style, include_descr);
out << "\n";
if (!smt2_style) {
out << "To set a module parameter, use <module-name>.<parameter-name>=value\n";
out << "Example: pp.decimal=true\n";
out << "\n";
}
for (auto & kv : get_module_param_descrs()) {
out << "[module] " << kv.m_key;
char const * descr = nullptr;
if (get_module_descrs().find(kv.m_key, descr)) {
out << ", description: " << descr;
}
out << "\n";
auto* d = kv.m_value->deref();
d->display(out, indent + 4, smt2_style, include_descr);
}
}
void display_modules(std::ostream & out) {
lock_guard lock(*gparams_mux);
for (auto & kv : get_module_param_descrs()) {
out << "[module] " << kv.m_key;
char const * descr = nullptr;
if (get_module_descrs().find(kv.m_key, descr)) {
out << ", description: " << descr;
}
out << "\n";
}
}
void display_module(std::ostream & out, char const* module_name) {
lock_guard lock(*gparams_mux);
param_descrs * d = nullptr;
if (!get_module_param_descr(module_name, d)) {
std::stringstream strm;
strm << "unknown module '" << module_name << "'";
throw exception(std::move(strm).str());
}
out << "[module] " << module_name;
char const * descr = nullptr;
if (get_module_descrs().find(module_name, descr)) {
out << ", description: " << descr;
}
out << "\n";
d->display(out, 4, false);
}
param_descrs const& get_global_param_descrs() {
lock_guard lock(*gparams_mux);
return get_param_descrs();
}
void display_parameter(std::ostream & out, char const * name) {
std::string m, p;
normalize(name, m, p);
symbol sp(p.c_str());
lock_guard lock(*gparams_mux);
out << name << " " << m << " " << p << "\n";
param_descrs * d;
if (!m[0]) {
d = &get_param_descrs();
}
else {
if (!get_module_param_descr(m, d)) {
std::stringstream strm;
strm << "unknown module '" << m << "'";
throw exception(std::move(strm).str());
}
}
if (!d->contains(sp))
throw_unknown_parameter(p, *d, m);
out << " name: " << p << "\n";
if (m[0]) {
out << " module: " << m << "\n";
out << " qualified name: " << m << "." << p << "\n";
}
out << " type: " << d->get_kind(sp) << "\n";
out << " description: " << d->get_descr(sp) << "\n";
out << " default value: " << d->get_default(sp) << "\n";
}
};
gparams::imp * gparams::g_imp = nullptr;
void gparams::reset() {
SASSERT(g_imp);
g_imp->reset();
}
void gparams::set(char const * name, char const * value) {
TRACE("gparams", tout << "setting [" << name << "] <- '" << value << "'\n";);
SASSERT(g_imp);
g_imp->set(name, value);
}
void gparams::set(symbol const & name, char const * value) {
SASSERT(g_imp);
g_imp->set(name.bare_str(), value);
}
std::string gparams::get_value(char const * name) {
SASSERT(g_imp);
return g_imp->get_value(name);
}
std::string gparams::get_value(symbol const & name) {
SASSERT(g_imp);
return g_imp->get_value(name.bare_str());
}
void gparams::register_global(param_descrs & d) {
SASSERT(g_imp);
g_imp->register_global(d);
}
void gparams::register_module(char const * module_name, lazy_descrs_t f) {
SASSERT(g_imp);
g_imp->register_module(module_name, f);
}
void gparams::register_module_descr(char const * module_name, char const * descr) {
SASSERT(g_imp);
g_imp->register_module_descr(module_name, descr);
}
params_ref gparams::get_module(char const * module_name) {
SASSERT(g_imp);
return g_imp->get_module(module_name);
}
params_ref const& gparams::get_ref() {
TRACE("gparams", tout << "gparams::get_ref()\n";);
SASSERT(g_imp);
return g_imp->get_ref();
}
void gparams::display(std::ostream & out, unsigned indent, bool smt2_style, bool include_descr) {
SASSERT(g_imp);
g_imp->display(out, indent, smt2_style, include_descr);
}
param_descrs const& gparams::get_global_param_descrs() {
return g_imp->get_global_param_descrs();
}
void gparams::display_modules(std::ostream & out) {
SASSERT(g_imp);
g_imp->display_modules(out);
}
void gparams::display_module(std::ostream & out, char const * module_name) {
SASSERT(g_imp);
g_imp->display_module(out, module_name);
}
void gparams::display_parameter(std::ostream & out, char const * name) {
SASSERT(g_imp);
g_imp->display_parameter(out, name);
}
void gparams::init() {
TRACE("gparams", tout << "gparams::init()\n";);
ALLOC_MUTEX(gparams_mux);
g_imp = alloc(imp);
}
void gparams::finalize() {
TRACE("gparams", tout << "gparams::finalize()\n";);
dealloc(g_imp);
DEALLOC_MUTEX(gparams_mux);
}
std::string& gparams::g_buffer() {
SASSERT(g_imp);
return g_imp->m_buffer;
}