File tree Expand file tree Collapse file tree 3 files changed +27
-8
lines changed Expand file tree Collapse file tree 3 files changed +27
-8
lines changed Original file line number Diff line number Diff line change 2
2
#include < goto-programs/initialize_goto_model.h>
3
3
4
4
#include < util/message.h>
5
+ #include < util/options.h>
6
+
7
+ #include " api.h"
8
+
9
+ api_depst api_deps;
10
+
11
+ // Initialise API dependencies
12
+ void initialize_api () {
13
+ // Initialise a null-message handler (we don't print anything yet)
14
+ api_deps.msg_handler = new null_message_handlert ();
15
+ // Initialise default options
16
+ api_deps.opts = new optionst ();
17
+ }
5
18
6
19
goto_modelt load_model_from_files (
7
20
const std::vector<std::string> &files,
8
21
const optionst &options)
9
22
{
10
- null_message_handlert null_msg_hnd;
11
- return initialize_goto_model (files, null_msg_hnd, options);
23
+ return initialize_goto_model (files, *api_deps.msg_handler , options);
12
24
}
Original file line number Diff line number Diff line change 2
2
3
3
#include < goto-programs/goto_model.h>
4
4
5
+ #include < util/message.h>
6
+ #include < util/options.h>
7
+
8
+ struct api_depst {
9
+ message_handlert *msg_handler;
10
+ optionst *opts;
11
+ };
12
+
13
+ void initialize_api ();
14
+
5
15
goto_modelt load_model_from_files (
6
16
const std::vector<std::string> &files,
7
17
const optionst &options);
Original file line number Diff line number Diff line change 12
12
#include < util/config.h>
13
13
#include < util/cmdline.h>
14
14
#include < util/message.h>
15
- #include < util/options.h>
16
15
17
16
#include " api.h"
18
17
18
+ extern api_depst api_deps;
19
+
19
20
int main (int argc, char *argv[])
20
21
{
21
22
try {
@@ -24,10 +25,6 @@ int main(int argc, char *argv[])
24
25
// Convert argv to vector of strings for initialize_goto_model
25
26
std::vector<std::string> arguments (argv + 1 , argv + argc);
26
27
27
- // Initialise a null-message handler (we don't print anything yet)
28
- null_message_handlert null_msg_hnd;
29
- // Default options
30
- optionst opts;
31
28
// Needed to initialise the language options correctly
32
29
cmdlinet cmdline;
33
30
@@ -37,7 +34,7 @@ int main(int argc, char *argv[])
37
34
// Initialise C language mode
38
35
register_language (new_ansi_c_language);
39
36
40
- auto model = load_model_from_files (arguments, opts);
37
+ auto model = load_model_from_files (arguments, *api_deps. opts );
41
38
42
39
std::cout << " Successfully initialised goto_model" << std::endl;
43
40
return 0 ;
You can’t perform that action at this time.
0 commit comments