00001 00008 /*************************************************************************** 00009 * * 00010 * This program is free software; you can redistribute it and/or modify * 00011 * it under the terms of the GNU General Public License as published by * 00012 * the Free Software Foundation; either version 2 of the License, or * 00013 * (at your option) any later version. * 00014 * * 00015 ***************************************************************************/ 00016 00017 #ifndef PYTHONSCRIPT_H 00018 #define PYTHONSCRIPT_H 00019 00020 #include <Python.h> 00021 00022 #include "../../config.h" 00023 #ifdef HAVE_OSTREAM 00024 #include <ostream> 00025 #else 00026 #include <ostream.h> 00027 #endif 00028 #include "applicationexception.h" 00029 class PycStringIO_CAPI; 00030 00031 using namespace std; 00032 00041 class PythonScript 00042 { 00043 public: 00053 PythonScript(ostream &debug, unsigned short debug_level, ostream &error, string filename, string functionname, PycStringIO_CAPI* cStringIO); 00054 00057 virtual ~PythonScript(); 00058 00059 protected: 00066 virtual void run() throw (ApplicationError); 00067 00070 virtual void final(); 00071 00077 string prefix(bool verbose=true); 00078 00079 string filename, 00080 functionname; 00081 PyObject *args; 00082 ostream &debug, 00083 &error; 00084 unsigned short debug_level; 00085 PycStringIO_CAPI* cStringIO; 00086 }; 00087 00088 #endif 00089 00090 /* History 00091 00092 $Log: pythonscript.h,v $ 00093 Revision 1.2 2003/03/21 23:09:59 gernot 00094 - included autoconf tests for gcc-2.95 problems so that it will compile w/o 00095 change for good old gcc-2.95 and gcc3 00096 00097 Revision 1.1.1.1 2003/02/19 08:19:53 gernot 00098 initial checkin of 0.4 00099 00100 Revision 1.6 2003/02/10 14:17:09 ghillie 00101 merged from NATIVE_PTHREADS to HEAD 00102 00103 Revision 1.5.2.2 2003/02/10 14:04:57 ghillie 00104 - made destructors virtual, otherwise wrong destructor is called! 00105 00106 Revision 1.5.2.1 2003/02/09 15:03:42 ghillie 00107 - rewritten to use native pthread_* calls instead of CommonC++ Thread 00108 00109 Revision 1.5 2003/01/18 12:55:39 ghillie 00110 - run handles python script errors now on its own and prints tracebacks 00111 to error log file correctly (solves TODO) 00112 00113 Revision 1.4 2003/01/04 16:00:53 ghillie 00114 - log improvements: log_level, timestamp 00115 00116 Revision 1.3 2002/12/14 14:04:20 ghillie 00117 - run throws ApplicationError now so that derived classes can catch 00118 and handle it on their behalf 00119 00120 Revision 1.2 2002/12/10 15:05:45 ghillie 00121 - finished pythonscript class definition 00122 00123 Revision 1.1 2002/12/09 18:07:59 ghillie 00124 - initial checkin, not finished! 00125 00126 */