From 52e2c4c6c014619d1a4e408f0e4f83253384f8f6 Mon Sep 17 00:00:00 2001 From: Dave Goodwin Date: Sun, 8 Jun 2003 14:52:11 +0000 Subject: [PATCH] initial import --- Cantera/cxx/writelog.cpp | 11 +++++++++++ Cantera/matlab/cantera/private/write.cpp | 25 ++++++++++++++++++++++++ Cantera/python/src/writelog.cpp | 25 ++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 Cantera/cxx/writelog.cpp create mode 100644 Cantera/matlab/cantera/private/write.cpp create mode 100644 Cantera/python/src/writelog.cpp 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]; + } + } + +}