cantera/Cantera/python/src/pyutils.h
2005-06-18 16:58:39 +00:00

26 lines
535 B
C
Executable file

#ifndef CTPY_UTILS
#define CTPY_UTILS
#include "Python.h"
static PyObject* reportCanteraError() {
char* buf = 0;
int buflen = getCanteraError(0, buf) + 1;
buf = new char[buflen+1];
getCanteraError(buflen, buf);
PyErr_SetString(ErrorObject,buf);
delete buf;
//writelogfile("log.html");
return NULL;
}
static PyObject* reportError(int n) {
if (n == -1) return reportCanteraError();
else if (n < 0) {
PyErr_SetString(ErrorObject,"Exception occurred.");
}
return NULL;
}
#endif