From eef674a644960cab7be9c4f4590e40fdc65f5a1e Mon Sep 17 00:00:00 2001 From: Dave Goodwin Date: Fri, 19 Aug 2005 03:17:16 +0000 Subject: [PATCH] corrected minor bugs in windows versions of files --- Cantera/matlab/cantera/buildwin.m | 24 ++++++++++---------- Cantera/matlab/cantera/private/ctmethods.cpp | 8 +++---- Cantera/matlab/cantera/private/mllogger.h | 11 +++++---- Cantera/matlab/cantera/private/write.cpp | 5 +++- Cantera/python/src/pycantera.cpp | 2 +- Cantera/src/logger.h | 19 ++++++++-------- Cantera/src/misc.cpp | 6 +++-- Cantera/src/oneD/MultiJac.cpp | 3 +-- config/configure.in | 12 +++++----- winconfig.h | 2 +- 10 files changed, 49 insertions(+), 43 deletions(-) diff --git a/Cantera/matlab/cantera/buildwin.m b/Cantera/matlab/cantera/buildwin.m index 382ec5796..fd053bce9 100755 --- a/Cantera/matlab/cantera/buildwin.m +++ b/Cantera/matlab/cantera/buildwin.m @@ -1,7 +1,7 @@ disp('building Cantera...'); diary -mex -I../../../build/include private/ctmethods.cpp ... +mex -v -I../../../build/include private/ctmethods.cpp ... private/ctfunctions.cpp ... private/xmlmethods.cpp private/phasemethods.cpp ... private/thermomethods.cpp private/kineticsmethods.cpp ... @@ -11,17 +11,17 @@ mex -I../../../build/include private/ctmethods.cpp ... private/wallmethods.cpp private/flowdevicemethods.cpp ... private/funcmethods.cpp ... private/onedimmethods.cpp private/surfmethods.cpp ... - ../../../build/lib/i686-pc-win32/clib.lib ... - ../../../build/lib/i686-pc-win32/oneD.lib ... - ../../../build/lib/i686-pc-win32/zeroD.lib ... - ../../../build/lib/i686-pc-win32/transport.lib ... - ../../../build/lib/i686-pc-win32/cantera.lib ... - ../../../build/lib/i686-pc-win32/recipes.lib ... - ../../../build/lib/i686-pc-win32/cvode.lib ... - ../../../build/lib/i686-pc-win32/ctlapack.lib ... - ../../../build/lib/i686-pc-win32/ctmath.lib ... - ../../../build/lib/i686-pc-win32/ctblas.lib ... - ../../../build/lib/i686-pc-win32/tpx.lib + ../../../build/lib/i686-pc-win32/clib.lib disp('done.'); diary off exit; +% ../../../build/lib/i686-pc-win32/oneD.lib ... +% ../../../build/lib/i686-pc-win32/zeroD.lib ... +% ../../../build/lib/i686-pc-win32/transport.lib ... +% ../../../build/lib/i686-pc-win32/cantera.lib ... +% ../../../build/lib/i686-pc-win32/recipes.lib ... +% ../../../build/lib/i686-pc-win32/cvode.lib ... +% ../../../build/lib/i686-pc-win32/ctlapack.lib ... +% ../../../build/lib/i686-pc-win32/ctmath.lib ... +% ../../../build/lib/i686-pc-win32/ctblas.lib ... +% ../../../build/lib/i686-pc-win32/tpx.lib diff --git a/Cantera/matlab/cantera/private/ctmethods.cpp b/Cantera/matlab/cantera/private/ctmethods.cpp index 1ac76f56e..2c4db918c 100644 --- a/Cantera/matlab/cantera/private/ctmethods.cpp +++ b/Cantera/matlab/cantera/private/ctmethods.cpp @@ -13,7 +13,7 @@ #include "mex.h" #include "ctmatutils.h" #include "mllogger.h" -#include "../../../src/global.h" +//#include "../../../src/global.h" namespace Cantera { void setMatlabMode(bool m); @@ -81,7 +81,7 @@ static Cantera::ML_Logger* _logger = 0; void initLogger() { if (!_logger) { _logger = new Cantera::ML_Logger; - Cantera::setLogger(_logger); + setLogWriter(_logger); } } @@ -94,11 +94,11 @@ extern "C" { // create a log writer for error messages if this is the // first MATLAB function call - initLogger(); + initLogger(); // flag specifying the class int iclass = getInt(prhs[0]); - + // Hand off to the appropriate routine, based on the // value of the first parameter switch (iclass) { diff --git a/Cantera/matlab/cantera/private/mllogger.h b/Cantera/matlab/cantera/private/mllogger.h index 439075842..8d5145023 100644 --- a/Cantera/matlab/cantera/private/mllogger.h +++ b/Cantera/matlab/cantera/private/mllogger.h @@ -8,7 +8,7 @@ #include using namespace std; -static std::string ss = "disp('"; +static string ss = "disp(' "; namespace Cantera { @@ -18,14 +18,15 @@ namespace Cantera { virtual ~ML_Logger() {} - virtual void write(const std::string& s) { + virtual void write(const string& s) { char ch = s[0]; int n = 0; while (ch != '\0') { if (ch =='\n') { ss += "');"; + mexEvalString(ss.c_str()); - ss = "disp('"; + ss = "disp(' "; } else ss += ch; @@ -36,8 +37,8 @@ namespace Cantera { } - virtual void error(const std::string& msg) { - std::string err = "error("+msg+");"; + virtual void error(const string& msg) { + string err = "error("+msg+");"; mexEvalString(err.c_str()); } diff --git a/Cantera/matlab/cantera/private/write.cpp b/Cantera/matlab/cantera/private/write.cpp index 92191151a..38eb3148f 100644 --- a/Cantera/matlab/cantera/private/write.cpp +++ b/Cantera/matlab/cantera/private/write.cpp @@ -7,13 +7,16 @@ static std::string ss = "disp('"; namespace Cantera { void writelog(const std::string& s) { + // debug + mexEvalString(s.c_str()); + // end debug char ch = s[0]; int n = 0; while (ch != '\0') { if (ch =='\n') { ss += " ');"; mexEvalString(ss.c_str()); - ss = "disp('"; + ss = "disp('doda: "; } else ss += ch; diff --git a/Cantera/python/src/pycantera.cpp b/Cantera/python/src/pycantera.cpp index 1c1944b4e..98f017915 100644 --- a/Cantera/python/src/pycantera.cpp +++ b/Cantera/python/src/pycantera.cpp @@ -62,7 +62,7 @@ static PyObject *ErrorObject; #include "methods.h" #include "pylogger.h" -#include "../../src/global.h" +//#include "../../src/global.h" extern "C" { /* Initialization function for the module */ diff --git a/Cantera/src/logger.h b/Cantera/src/logger.h index 0b292c268..2bc614642 100644 --- a/Cantera/src/logger.h +++ b/Cantera/src/logger.h @@ -36,15 +36,16 @@ namespace Cantera { class Logger { public: - Logger() {} - virtual ~Logger() {} + Logger() {} + virtual ~Logger() {} - /// Write a log message. The default behavior is to write to - /// the standard output. Note that no end-of-line character is - /// appended to the message, and so if one is desired it must - /// be included in the string. - virtual void write(const string& msg) { - cout << msg; + /// Write a log message. The default behavior is to write to + /// the standard output. Note that no end-of-line character is + /// appended to the message, and so if one is desired it must + /// be included in the string. + + virtual void write(const string& msg) { + cout << msg; } /// Write an error message and quit. The default behavior is @@ -55,7 +56,7 @@ namespace Cantera { /// terminate the application Cantera is invoked from (MATLAB, /// Excel, etc.) If this is not desired, then derive a class /// and reimplement this method. - virtual void error(const string& msg) { + virtual void error(const string& msg) { cerr << msg << endl; exit(-1); } diff --git a/Cantera/src/misc.cpp b/Cantera/src/misc.cpp index e84a6955c..e9297d766 100755 --- a/Cantera/src/misc.cpp +++ b/Cantera/src/misc.cpp @@ -57,7 +57,6 @@ namespace Cantera { // install a default logwriter that writes to standard // output / standard error logwriter = new Logger(); - // HTML log files xmllog = 0; current = 0; @@ -111,7 +110,9 @@ namespace Cantera { Unit* Unit::__u = 0; static void appinit() { - if (__app == 0) __app = new Application; + if (__app == 0) { + __app = new Application; + } } /** @@ -618,6 +619,7 @@ namespace Cantera { /// test /// @ingroup textlogs int userInterface() { + appinit(); return app()->logwriter->env(); } diff --git a/Cantera/src/oneD/MultiJac.cpp b/Cantera/src/oneD/MultiJac.cpp index 3d69b6be0..c46a01881 100644 --- a/Cantera/src/oneD/MultiJac.cpp +++ b/Cantera/src/oneD/MultiJac.cpp @@ -22,9 +22,8 @@ //#include //#include -using namespace std; - #include "MultiJac.h" +using namespace std; namespace Cantera { diff --git a/config/configure.in b/config/configure.in index cdddb93f6..bd4894b29 100755 --- a/config/configure.in +++ b/config/configure.in @@ -882,7 +882,7 @@ AC_OUTPUT(../Cantera/Makefile \ ) # ) if test "x${OS_IS_WIN}" = "x1"; then -cp -f ../config.h ../Cantera/src +#cp -f ../config.h ../Cantera/src cd ../ext/f2c_libs cp arith.hwin32 arith.h cd ../../config @@ -898,11 +898,11 @@ fi echo if test "x${OS_IS_WIN}" = "x0"; then echo "Now type '${MAKE}' to build Cantera" -else -echo "Now start Visual Studio, open workspace 'win32/cantera.dsw'," -echo "and build project 'all'. When this finishes, come back here and " -echo "type 'make win' to make the Python and/or MATLAB interfaces." -fi +#else +#echo "Now start Visual Studio, open workspace 'win32/cantera.dsw'," +#echo "and build project 'all'. When this finishes, come back here and " +#echo "type 'make win' to make the Python and/or MATLAB interfaces." +#fi echo # $Log: configure.in,v diff --git a/winconfig.h b/winconfig.h index 074d1cdca..ef942b820 100644 --- a/winconfig.h +++ b/winconfig.h @@ -59,7 +59,7 @@ typedef int ftnlen; // Fortran hidden string length type // The configure script defines this if the operatiing system is Mac // OS X, This used to add some Mac-specific directories to the default // data file search path. -#define DARWIN 0 +/* #undef DARWIN */ #define HAS_SSTREAM /* #undef HAS_SSTREAM */