File tree Expand file tree Collapse file tree 4 files changed +25
-12
lines changed Expand file tree Collapse file tree 4 files changed +25
-12
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,7 @@ namespace xcpp
19
19
{
20
20
public:
21
21
22
- wasm_interpreter ();
23
- wasm_interpreter (int argc, char ** argv);
22
+ wasm_interpreter (const std::vector<std::string>& args);
24
23
virtual ~wasm_interpreter () = default ;
25
24
26
25
};
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ namespace xcpp
32
32
33
33
XEUS_CPP_API
34
34
std::string retrieve_tagfile_dir ();
35
+
36
+ XEUS_CPP_API
37
+ std::pair<int , char **> convert_to_argv (const std::vector<std::string>& args);
35
38
}
36
39
37
40
#endif
Original file line number Diff line number Diff line change 12
12
13
13
#include " xeus-cpp/xinterpreter.hpp"
14
14
#include " xeus-cpp/xinterpreter_wasm.hpp"
15
+ #include " xeus-cpp/xutils.hpp"
15
16
16
17
namespace xcpp
17
18
{
18
-
19
- wasm_interpreter::wasm_interpreter ()
20
- : interpreter(0 , nullptr )
21
- {
22
- }
23
-
24
- wasm_interpreter::wasm_interpreter (int argc, char ** argv)
25
- : interpreter(argc, argv)
26
- {
27
- }
19
+ wasm_interpreter::wasm_interpreter (const std::vector<std::string>& args)
20
+ : interpreter(convert_to_argv(args).first, convert_to_argv(args).second)
21
+ {}
28
22
}
Original file line number Diff line number Diff line change @@ -102,4 +102,21 @@ namespace xcpp
102
102
103
103
return prefix + " share" + separator + " xeus-cpp" + separator + " tagfiles" ;
104
104
}
105
+
106
+ std::pair<int , char **> convert_to_argv (const std::vector<std::string>& args)
107
+ {
108
+ static std::vector<std::string> persistent_args = args;
109
+ static std::vector<const char *> argv_vec;
110
+
111
+ argv_vec.clear ();
112
+ for (const auto & s : persistent_args)
113
+ {
114
+ argv_vec.push_back (s.c_str ());
115
+ }
116
+
117
+ return {
118
+ static_cast <int >(argv_vec.size ()),
119
+ const_cast <char **>(argv_vec.data ())
120
+ };
121
+ }
105
122
}
You can’t perform that action at this time.
0 commit comments