/[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 500 by johnpye, Tue Apr 18 11:55:12 2006 UTC
# Line 6  Line 6 
6  #include <iostream>  #include <iostream>
7  using namespace std;  using namespace std;
8    
9    #include "config.h"
10    #ifndef ASCXX_USE_PYTHON
11    # error "Where's ASCXX_USE_PYTHON?"
12    #endif
13    
14  #include "reporter.h"  #include "reporter.h"
15    
16  static const int REPORTER_MAX_ERROR_MSG = 1024;  static const int REPORTER_MAX_ERROR_MSG = 1024;
# Line 61  int Line 66  int
66  Reporter::reportErrorPython(ERROR_REPORTER_CALLBACK_ARGS){  Reporter::reportErrorPython(ERROR_REPORTER_CALLBACK_ARGS){
67      PyObject *pyfunc, *pyarglist, *pyresult;      PyObject *pyfunc, *pyarglist, *pyresult;
68      pyfunc = (PyObject *)client_data;      pyfunc = (PyObject *)client_data;
69        
70      char msg[REPORTER_MAX_ERROR_MSG];      char msg[REPORTER_MAX_ERROR_MSG];
71      vsprintf(msg,fmt,args);      vsprintf(msg,fmt,args);
72    
73      //cerr << "reportErrorPython: msg=" << msg ;      //cerr << "reportErrorPython: msg=" << msg ;
74      //cerr << "reportErrorPython: pyfunc=" << pyfunc << endl;      //cerr << "reportErrorPython: pyfunc=" << pyfunc << endl;
75        
76      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
77      pyresult = PyEval_CallObject(pyfunc,pyarglist);     // Call Python      pyresult = PyEval_CallObject(pyfunc,pyarglist);     // Call Python
78      Py_DECREF(pyarglist);                           // Trash arglist      Py_DECREF(pyarglist);                           // Trash arglist
# Line 79  Reporter::reportErrorPython(ERROR_REPORT Line 84  Reporter::reportErrorPython(ERROR_REPORT
84      }else{      }else{
85          //cerr << "pyresult = 0"<< endl;          //cerr << "pyresult = 0"<< endl;
86      }      }
87            
88      Py_XDECREF(pyresult);      Py_XDECREF(pyresult);
89      return res;      return res;
90  }  }
91    
92  void  void

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

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