From e60cc5b8db38454b7886ac69abba26f02d77591d Mon Sep 17 00:00:00 2001 From: Dave Goodwin Date: Sat, 16 Oct 2004 09:12:47 +0000 Subject: [PATCH] *** empty log message *** --- Cantera/clib/src/ct.cpp | 5 +++++ Cantera/clib/src/ct.h | 1 + Cantera/python/src/pycantera.cpp | 2 +- Cantera/python/src/pyutils.h | 18 +++++++++--------- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Cantera/clib/src/ct.cpp b/Cantera/clib/src/ct.cpp index 7b95c3701..1233d0589 100755 --- a/Cantera/clib/src/ct.cpp +++ b/Cantera/clib/src/ct.cpp @@ -984,6 +984,11 @@ extern "C" { return 0; } + int DLL_EXPORT setLogWriter(void* logger) { + Logger* logwriter = (Logger*)logger; + setLogger(logwriter); + } + int DLL_EXPORT readlog(int n, char* buf) { string s; writelog("function readlog is deprecated!"); diff --git a/Cantera/clib/src/ct.h b/Cantera/clib/src/ct.h index 25cd9cec2..54dc6e1b3 100755 --- a/Cantera/clib/src/ct.h +++ b/Cantera/clib/src/ct.h @@ -141,6 +141,7 @@ extern "C" { char* id, int validate, double threshold); int DLL_IMPORT getCanteraError(int buflen, char* buf); int DLL_IMPORT showCanteraErrors(); + int DLL_IMPORT setLogWriter(void* logger); int DLL_IMPORT addCanteraDirectory(int buflen, char* buf); int DLL_IMPORT clearStorage(); int DLL_IMPORT delPhase(int n); diff --git a/Cantera/python/src/pycantera.cpp b/Cantera/python/src/pycantera.cpp index f113ae18b..5d10e6bd1 100644 --- a/Cantera/python/src/pycantera.cpp +++ b/Cantera/python/src/pycantera.cpp @@ -71,7 +71,7 @@ extern "C" { m = Py_InitModule("_cantera", ct_methods); import_array(); Cantera::Logger* pylog = new Cantera::Py_Logger; - setLogger(pylog); + setLogWriter(pylog); /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); diff --git a/Cantera/python/src/pyutils.h b/Cantera/python/src/pyutils.h index b38757f8f..fffc534a8 100755 --- a/Cantera/python/src/pyutils.h +++ b/Cantera/python/src/pyutils.h @@ -2,17 +2,17 @@ #define CTPY_UTILS #include "Python.h" -#include "../../src/global.h" +//#include "../../clib/src/ct.h" static PyObject* reportCanteraError() { - Cantera::showErrors(); - //char* buf = 0; - //int buflen = getCanteraError(0, buf) + 1; - //buf = new char[buflen+1]; - //getCanteraError(buflen, buf); - //PyErr_SetString(ErrorObject,buf); - //delete buf; - PyErr_SetString(ErrorObject,"An exception was thrown by Cantera."); + //showCanteraErrors(); + char* buf = 0; + int buflen = getCanteraError(0, buf) + 1; + buf = new char[buflen+1]; + getCanteraError(buflen, buf); + PyErr_SetString(ErrorObject,buf); + delete buf; + //PyErr_SetString(ErrorObject,"An exception was thrown by Cantera."); return NULL; }