diff --git a/Cantera/cxx/writelog.cpp b/Cantera/cxx/writelog.cpp new file mode 100644 index 000000000..874d28f54 --- /dev/null +++ b/Cantera/cxx/writelog.cpp @@ -0,0 +1,11 @@ +#include +#include +using namespace std; + +namespace Cantera { + + void writelog(const string& s) { + cout << s; + } + +} diff --git a/Cantera/matlab/cantera/private/write.cpp b/Cantera/matlab/cantera/private/write.cpp new file mode 100644 index 000000000..0d5a4fd11 --- /dev/null +++ b/Cantera/matlab/cantera/private/write.cpp @@ -0,0 +1,25 @@ + +#include "mex.h" +#include + +static std::string ss = "disp('"; + +namespace Cantera { + + void writelog(const std::string& s) { + char ch = s[0]; + int n = 0; + while (ch != '\0') { + if (ch =='\n') { + ss += " ');"; + mexEvalString(ss.c_str()); + ss = "disp('"; + } + else + ss += ch; + n++; + ch = s[n]; + } + } + +} diff --git a/Cantera/python/src/writelog.cpp b/Cantera/python/src/writelog.cpp new file mode 100644 index 000000000..5c36f3341 --- /dev/null +++ b/Cantera/python/src/writelog.cpp @@ -0,0 +1,25 @@ +#include "Python.h" +#include +using namespace std; + +static std::string ss = "print \""; + +namespace Cantera { + + void writelog(const string& s) { + char ch = s[0]; + int n = 0; + while (ch != '\0') { + if (ch =='\n') { + ss += "\""; + PyRun_SimpleString((char *)ss.c_str()); + ss = "print \""; + } + else + ss += ch; + n++; + ch = s[n]; + } + } + +}