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 <../../config.h> 00021 #include <Python.h> 00022 #ifdef HAVE_OSTREAM 00023 #include <ostream> 00024 #else 00025 #include <ostream.h> 00026 #endif 00027 #include "applicationexception.h" 00028 class PycStringIO_CAPI; 00029 00030 using namespace std; 00031 00040 class PythonScript 00041 { 00042 public: 00052 PythonScript(ostream &debug, unsigned short debug_level, ostream &error, string filename, string functionname, PycStringIO_CAPI* cStringIO); 00053 00056 virtual ~PythonScript(); 00057 00058 protected: 00065 virtual void run() throw (ApplicationError); 00066 00069 virtual void final(); 00070 00075 string prefix(); 00076 00077 string filename, 00078 functionname; 00079 PyObject *args; 00080 ostream &debug, 00081 &error; 00082 unsigned short debug_level; 00083 PycStringIO_CAPI* cStringIO; 00084 }; 00085 00086 #endif 00087 00088 /* History 00089 00090 Old Log (for new changes see ChangeLog): 00091 Revision 1.2 2003/03/21 23:09:59 gernot 00092 - included autoconf tests for gcc-2.95 problems so that it will compile w/o 00093 change for good old gcc-2.95 and gcc3 00094 00095 Revision 1.1.1.1 2003/02/19 08:19:53 gernot 00096 initial checkin of 0.4 00097 00098 Revision 1.6 2003/02/10 14:17:09 ghillie 00099 merged from NATIVE_PTHREADS to HEAD 00100 00101 Revision 1.5.2.2 2003/02/10 14:04:57 ghillie 00102 - made destructors virtual, otherwise wrong destructor is called! 00103 00104 Revision 1.5.2.1 2003/02/09 15:03:42 ghillie 00105 - rewritten to use native pthread_* calls instead of CommonC++ Thread 00106 00107 Revision 1.5 2003/01/18 12:55:39 ghillie 00108 - run handles python script errors now on its own and prints tracebacks 00109 to error log file correctly (solves TODO) 00110 00111 Revision 1.4 2003/01/04 16:00:53 ghillie 00112 - log improvements: log_level, timestamp 00113 00114 Revision 1.3 2002/12/14 14:04:20 ghillie 00115 - run throws ApplicationError now so that derived classes can catch 00116 and handle it on their behalf 00117 00118 Revision 1.2 2002/12/10 15:05:45 ghillie 00119 - finished pythonscript class definition 00120 00121 Revision 1.1 2002/12/09 18:07:59 ghillie 00122 - initial checkin, not finished! 00123 00124 */