From 8baa46e9bfc96ce59bf02062349be413e123e971 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 26 Jun 2002 20:11:34 +0000 Subject: [PATCH] Some trace log updates git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15966 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/misc2.i | 38 +++++++++++++++++++++++++++++++++++-- wxPython/src/msw/misc2.cpp | 39 +++++++++++++++++--------------------- wxPython/src/msw/misc2.py | 10 ++++++++++ 3 files changed, 63 insertions(+), 24 deletions(-) diff --git a/wxPython/src/misc2.i b/wxPython/src/misc2.i index ef93904448..889b33ecd4 100644 --- a/wxPython/src/misc2.i +++ b/wxPython/src/misc2.i @@ -563,6 +563,27 @@ enum wxLOG_User = 100 // user defined levels start here }; +#define wxTRACE_MemAlloc "memalloc" // trace memory allocation (new/delete) +#define wxTRACE_Messages "messages" // trace window messages/X callbacks +#define wxTRACE_ResAlloc "resalloc" // trace GDI resource allocation +#define wxTRACE_RefCount "refcount" // trace various ref counting operations + +#ifdef __WXMSW__ +#define wxTRACE_OleCalls "ole" // OLE interface calls +#endif + +enum { + wxTraceMemAlloc, + wxTraceMessages, + wxTraceResAlloc, + wxTraceRefCount, + +#ifdef __WXMSW__ + wxTraceOleCalls, +#endif +}; + + class wxLog { @@ -571,7 +592,7 @@ public: static bool IsEnabled(); static bool EnableLogging(bool doIt = TRUE); - static void OnLog(wxLogLevel level, const wxString& szString, int t=0); + static void OnLog(unsigned long level, const wxString& szString, int t=0); virtual void Flush(); bool HasPendingMessages() const; @@ -586,7 +607,7 @@ public: static void SetVerbose(bool bVerbose = TRUE); static void DontCreateOnDemand(); - static void SetTraceMask(wxTraceMask ulMask); + static void SetTraceMask(long ulMask); static void AddTraceMask(const wxString& str); static void RemoveTraceMask(const wxString& str); static void ClearTraceMasks(); @@ -1512,11 +1533,24 @@ public: //---------------------------------------------------------------------- //---------------------------------------------------------------------- +// %{ +// #if wxUSE_UNICODE +// #define ADD_STRING(dict, str) \ +// wxString tmp##str(str); \ +// PyDict_SetItemString(dict, #str, \ +// PyUnicode_FromUnicode(tmp##str.c_str(), tmp##str.Len())) +// #else +// #define ADD_STRING(dict, str) \ +// PyDict_SetItemString(d, #str, PyString_FromString(str)) +// #endif +// %} + %init %{ wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage"); wxPyPtrTypeMap_Add("wxProcess", "wxPyProcess"); wxPyPtrTypeMap_Add("wxArtProvider", "wxPyArtProvider"); + %} //---------------------------------------------------------------------- diff --git a/wxPython/src/msw/misc2.cpp b/wxPython/src/msw/misc2.cpp index 0f2e7c818c..a00c179721 100644 --- a/wxPython/src/msw/misc2.cpp +++ b/wxPython/src/msw/misc2.cpp @@ -4620,23 +4620,15 @@ static PyObject *_wrap_wxLog_EnableLogging(PyObject *self, PyObject *args, PyObj static PyObject *_wrap_wxLog_OnLog(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - wxLogLevel * _arg0; + unsigned long _arg0; wxString * _arg1; int _arg2 = (int ) 0; - PyObject * _argo0 = 0; PyObject * _obj1 = 0; char *_kwnames[] = { "level","szString","t", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|i:wxLog_OnLog",_kwnames,&_argo0,&_obj1,&_arg2)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"lO|i:wxLog_OnLog",_kwnames,&_arg0,&_obj1,&_arg2)) return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxLogLevel_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxLog_OnLog. Expected _wxLogLevel_p."); - return NULL; - } - } { _arg1 = wxString_in_helper(_obj1); if (_arg1 == NULL) @@ -4644,7 +4636,7 @@ static PyObject *_wrap_wxLog_OnLog(PyObject *self, PyObject *args, PyObject *kwa } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - wxLog::OnLog(*_arg0,*_arg1,_arg2); + wxLog::OnLog(_arg0,*_arg1,_arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -4867,23 +4859,15 @@ static PyObject *_wrap_wxLog_DontCreateOnDemand(PyObject *self, PyObject *args, static PyObject *_wrap_wxLog_SetTraceMask(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - wxTraceMask * _arg0; - PyObject * _argo0 = 0; + long _arg0; char *_kwnames[] = { "ulMask", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxLog_SetTraceMask",_kwnames,&_argo0)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"l:wxLog_SetTraceMask",_kwnames,&_arg0)) return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTraceMask_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxLog_SetTraceMask. Expected _wxTraceMask_p."); - return NULL; - } - } { PyThreadState* __tstate = wxPyBeginAllowThreads(); - wxLog::SetTraceMask(*_arg0); + wxLog::SetTraceMask(_arg0); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -10713,6 +10697,16 @@ SWIGEXPORT(void) initmisc2c() { PyDict_SetItemString(d,"wxLOG_Trace", PyInt_FromLong((long) wxLOG_Trace)); PyDict_SetItemString(d,"wxLOG_Progress", PyInt_FromLong((long) wxLOG_Progress)); PyDict_SetItemString(d,"wxLOG_User", PyInt_FromLong((long) wxLOG_User)); + PyDict_SetItemString(d,"wxTRACE_MemAlloc", PyString_FromString("memalloc")); + PyDict_SetItemString(d,"wxTRACE_Messages", PyString_FromString("messages")); + PyDict_SetItemString(d,"wxTRACE_ResAlloc", PyString_FromString("resalloc")); + PyDict_SetItemString(d,"wxTRACE_RefCount", PyString_FromString("refcount")); + PyDict_SetItemString(d,"wxTRACE_OleCalls", PyString_FromString("ole")); + PyDict_SetItemString(d,"wxTraceMemAlloc", PyInt_FromLong((long) wxTraceMemAlloc)); + PyDict_SetItemString(d,"wxTraceMessages", PyInt_FromLong((long) wxTraceMessages)); + PyDict_SetItemString(d,"wxTraceResAlloc", PyInt_FromLong((long) wxTraceResAlloc)); + PyDict_SetItemString(d,"wxTraceRefCount", PyInt_FromLong((long) wxTraceRefCount)); + PyDict_SetItemString(d,"wxTraceOleCalls", PyInt_FromLong((long) wxTraceOleCalls)); PyDict_SetItemString(d,"wxEVT_END_PROCESS", PyInt_FromLong((long) wxEVT_END_PROCESS)); PyDict_SetItemString(d,"wxEXEC_ASYNC", PyInt_FromLong((long) wxEXEC_ASYNC)); PyDict_SetItemString(d,"wxEXEC_SYNC", PyInt_FromLong((long) wxEXEC_SYNC)); @@ -10766,6 +10760,7 @@ SWIGEXPORT(void) initmisc2c() { wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage"); wxPyPtrTypeMap_Add("wxProcess", "wxPyProcess"); wxPyPtrTypeMap_Add("wxArtProvider", "wxPyArtProvider"); + { int i; for (i = 0; _swig_mapping[i].n1; i++) diff --git a/wxPython/src/msw/misc2.py b/wxPython/src/msw/misc2.py index 7c14d74d68..77cebf2116 100644 --- a/wxPython/src/msw/misc2.py +++ b/wxPython/src/msw/misc2.py @@ -1318,6 +1318,16 @@ wxLOG_Debug = misc2c.wxLOG_Debug wxLOG_Trace = misc2c.wxLOG_Trace wxLOG_Progress = misc2c.wxLOG_Progress wxLOG_User = misc2c.wxLOG_User +wxTRACE_MemAlloc = misc2c.wxTRACE_MemAlloc +wxTRACE_Messages = misc2c.wxTRACE_Messages +wxTRACE_ResAlloc = misc2c.wxTRACE_ResAlloc +wxTRACE_RefCount = misc2c.wxTRACE_RefCount +wxTRACE_OleCalls = misc2c.wxTRACE_OleCalls +wxTraceMemAlloc = misc2c.wxTraceMemAlloc +wxTraceMessages = misc2c.wxTraceMessages +wxTraceResAlloc = misc2c.wxTraceResAlloc +wxTraceRefCount = misc2c.wxTraceRefCount +wxTraceOleCalls = misc2c.wxTraceOleCalls wxEVT_END_PROCESS = misc2c.wxEVT_END_PROCESS wxEXEC_ASYNC = misc2c.wxEXEC_ASYNC wxEXEC_SYNC = misc2c.wxEXEC_SYNC