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
1919 {
2020 public:
2121
22- wasm_interpreter ();
23- wasm_interpreter (int argc, char ** argv);
22+ wasm_interpreter (const std::vector<std::string>& args);
2423 virtual ~wasm_interpreter () = default ;
2524
2625 };
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ namespace xcpp
3232
3333 XEUS_CPP_API
3434 std::string retrieve_tagfile_dir ();
35+
36+ XEUS_CPP_API
37+ std::pair<int , char **> convert_to_argv (const std::vector<std::string>& args);
3538}
3639
3740#endif
Original file line number Diff line number Diff line change 1212
1313#include " xeus-cpp/xinterpreter.hpp"
1414#include " xeus-cpp/xinterpreter_wasm.hpp"
15+ #include " xeus-cpp/xutils.hpp"
1516
1617namespace xcpp
1718{
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+ {}
2822}
Original file line number Diff line number Diff line change @@ -102,4 +102,21 @@ namespace xcpp
102102
103103 return prefix + " share" + separator + " xeus-cpp" + separator + " tagfiles" ;
104104 }
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+ }
105122}
You can’t perform that action at this time.
0 commit comments