1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Morgan Deters, Aina Niemetz, Gereon Kremer |
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 |
|
* Main driver for cvc5 executable. |
14 |
|
*/ |
15 |
|
#include "main/main.h" |
16 |
|
|
17 |
|
#include <stdio.h> |
18 |
|
#include <unistd.h> |
19 |
|
|
20 |
|
#include <cstdlib> |
21 |
|
#include <cstring> |
22 |
|
#include <fstream> |
23 |
|
#include <iostream> |
24 |
|
|
25 |
|
#include "base/configuration.h" |
26 |
|
#include "base/output.h" |
27 |
|
#include "main/command_executor.h" |
28 |
|
#include "main/interactive_shell.h" |
29 |
|
#include "options/base_options.h" |
30 |
|
#include "options/language.h" |
31 |
|
#include "options/option_exception.h" |
32 |
|
#include "options/options.h" |
33 |
|
#include "parser/parser.h" |
34 |
|
#include "parser/parser_builder.h" |
35 |
|
#include "parser/parser_exception.h" |
36 |
|
#include "util/result.h" |
37 |
|
|
38 |
|
using namespace std; |
39 |
|
using namespace cvc5; |
40 |
|
using namespace cvc5::main; |
41 |
|
using namespace cvc5::language; |
42 |
|
|
43 |
|
/** |
44 |
|
* cvc5's main() routine is just an exception-safe wrapper around cvc5. |
45 |
|
* Please don't construct anything here. Even if the constructor is |
46 |
|
* inside the try { }, an exception during destruction can cause |
47 |
|
* problems. That's why main() wraps runCvc5() in the first place. |
48 |
|
* Put everything in runCvc5(). |
49 |
|
*/ |
50 |
8740 |
int main(int argc, char* argv[]) { |
51 |
14851 |
Options opts; |
52 |
|
try { |
53 |
8740 |
return runCvc5(argc, argv, opts); |
54 |
2 |
} catch(OptionException& e) { |
55 |
|
#ifdef CVC5_COMPETITION_MODE |
56 |
|
*opts.base.out << "unknown" << endl; |
57 |
|
#endif |
58 |
1 |
cerr << "(error \"" << e << "\")" << endl |
59 |
1 |
<< endl |
60 |
1 |
<< "Please use --help to get help on command-line options." << endl; |
61 |
40 |
} catch(Exception& e) { |
62 |
|
#ifdef CVC5_COMPETITION_MODE |
63 |
|
*opts.base.out << "unknown" << endl; |
64 |
|
#endif |
65 |
20 |
if (language::isOutputLang_smt2(opts.base.outputLanguage)) |
66 |
|
{ |
67 |
16 |
*opts.base.out << "(error \"" << e << "\")" << endl; |
68 |
|
} else { |
69 |
4 |
*opts.base.err << "(error \"" << e << "\")" << endl; |
70 |
|
} |
71 |
20 |
if (opts.base.statistics && pExecutor != nullptr) |
72 |
|
{ |
73 |
|
totalTime.reset(); |
74 |
|
pExecutor->printStatistics(*opts.base.err); |
75 |
|
} |
76 |
|
} |
77 |
21 |
exit(1); |
78 |
26220 |
} |