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