/[ascend]/trunk/pygtk/interface/reporter.cpp
ViewVC logotype

Diff of /trunk/pygtk/interface/reporter.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 190 by johnpye, Mon Jan 16 08:53:30 2006 UTC revision 508 by johnpye, Wed Apr 19 04:48:32 2006 UTC
# Line 1  Line 1 
1  #ifdef ASCXX_USE_PYTHON  #include "config.h"
2  # include <Python.h>  #include "reporter.h"
 #endif  
3    
4  #include <cstdio>  #include <cstdio>
5  #include <iostream>  #include <iostream>
6  using namespace std;  using namespace std;
7    
8  #include "reporter.h"  #ifndef ASCXX_USE_PYTHON
9    # error "Where's ASCXX_USE_PYTHON?"
10    #endif
11    
12    
13  static const int REPORTER_MAX_ERROR_MSG = 1024;  static const int REPORTER_MAX_ERROR_MSG = 1024;
14    
# Line 61  int Line 63  int
63  Reporter::reportErrorPython(ERROR_REPORTER_CALLBACK_ARGS){  Reporter::reportErrorPython(ERROR_REPORTER_CALLBACK_ARGS){
64      PyObject *pyfunc, *pyarglist, *pyresult;      PyObject *pyfunc, *pyarglist, *pyresult;
65      pyfunc = (PyObject *)client_data;      pyfunc = (PyObject *)client_data;
66        
67      char msg[REPORTER_MAX_ERROR_MSG];      char msg[REPORTER_MAX_ERROR_MSG];
68      vsprintf(msg,fmt,args);      vsprintf(msg,fmt,args);
69    
70      //cerr << "reportErrorPython: msg=" << msg ;      cerr << "reportErrorPython: msg=" << msg ;
71      //cerr << "reportErrorPython: pyfunc=" << pyfunc << endl;      cerr << "reportErrorPython: pyfunc=" << pyfunc << endl;
72        
73      pyarglist = Py_BuildValue("(H,z,i,z)",sev,filename,line,msg);             // Build argument list      pyarglist = Py_BuildValue("(H,z,i,z)",sev,filename,line,msg);             // Build argument list
74      pyresult = PyEval_CallObject(pyfunc,pyarglist);     // Call Python      pyresult = PyEval_CallObject(pyfunc,pyarglist);     // Call Python
75      Py_DECREF(pyarglist);                           // Trash arglist      Py_DECREF(pyarglist);                           // Trash arglist
# Line 79  Reporter::reportErrorPython(ERROR_REPORT Line 81  Reporter::reportErrorPython(ERROR_REPORT
81      }else{      }else{
82          //cerr << "pyresult = 0"<< endl;          //cerr << "pyresult = 0"<< endl;
83      }      }
84            
85      Py_XDECREF(pyresult);      Py_XDECREF(pyresult);
86      return res;      return res;
87  }  }
88    
89  void  void

Legend:
Removed from v.190  
changed lines
  Added in v.508

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22