/[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 528 by johnpye, Fri Apr 21 13:47:31 2006 UTC revision 529 by johnpye, Sat Apr 22 06:26:23 2006 UTC
# Line 15  static const int REPORTER_MAX_ERROR_MSG Line 15  static const int REPORTER_MAX_ERROR_MSG
15  #ifdef ASCXX_USE_PYTHON  #ifdef ASCXX_USE_PYTHON
16  // Python-invoking callback function  // Python-invoking callback function
17  int reporter_error_python(ERROR_REPORTER_CALLBACK_ARGS){  int reporter_error_python(ERROR_REPORTER_CALLBACK_ARGS){
18    /*
19        const error_severity_t sev \
20      , const char *filename \
21      , const int line \
22      , const char *funcname \
23      , const char *fmt \
24      , const va_list args
25    */
26    /*
27      int res=0;      int res=0;
28      if(filename!=NULL){      if(filename!=NULL){
29          res += ASC_FPRINTF(ASCERR,"%s:",filename);          res += ASC_FPRINTF(ASCERR,"%s:",filename);
# Line 31  int reporter_error_python(ERROR_REPORTER Line 40  int reporter_error_python(ERROR_REPORTER
40    
41      res += ASC_VFPRINTF(ASCERR,fmt,args);      res += ASC_VFPRINTF(ASCERR,fmt,args);
42      return res;      return res;
43      //Reporter *reporter = Reporter::Instance();  */
44      //return reporter->reportErrorPython(ERROR_REPORTER_CALLBACK_VARS);      Reporter *reporter = Reporter::Instance();
45        return reporter->reportErrorPython(ERROR_REPORTER_CALLBACK_VARS);
46  }  }
47  #endif  #endif
48    
# Line 83  Reporter::reportErrorPython(ERROR_REPORT Line 93  Reporter::reportErrorPython(ERROR_REPORT
93      char msg[REPORTER_MAX_ERROR_MSG];      char msg[REPORTER_MAX_ERROR_MSG];
94      vsprintf(msg,fmt,args);      vsprintf(msg,fmt,args);
95    
96      cerr << "reportErrorPython: msg=" << msg ;      cerr << "reportErrorPython: [[[start]]]: msg[" << strlen(msg) << "]=" << msg ;
97      cerr << "reportErrorPython: pyfunc=" << pyfunc << endl;      cerr << "reportErrorPython: pyfunc=" << pyfunc << endl;
98        if(filename==NULL){
99            cerr << "reportErrorPython: filename is NULL" << endl;
100        }else{
101            cerr << "reportErrorPython: filename[" << strlen(msg) << "]=" << filename << endl;
102        }
103        //cerr << "reportErrorPython: line=" << line << endl;
104      cerr.flush();      cerr.flush();
105    
106      pyarglist = Py_BuildValue("(H,z,i,z)",sev,filename,line,msg);             // Build argument list      pyarglist = Py_BuildValue("(H,s,i,s#)",sev,filename,line,msg,strlen(msg));             // Build argument list
107      pyresult = PyEval_CallObject(pyfunc,pyarglist);     // Call Python      pyresult = PyEval_CallObject(pyfunc,pyarglist);     // Call Python
108      Py_DECREF(pyarglist);                           // Trash arglist      Py_DECREF(pyarglist);                           // Trash arglist
109    
# Line 100  Reporter::reportErrorPython(ERROR_REPORT Line 116  Reporter::reportErrorPython(ERROR_REPORT
116      }      }
117    
118      Py_XDECREF(pyresult);      Py_XDECREF(pyresult);
119        cerr << "reportErrorPython: [[[return]]]" << endl;
120      return res;      return res;
121  }  }
122    

Legend:
Removed from v.528  
changed lines
  Added in v.529

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