Doc updates (debug stuff); Cygwin corrections
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1015 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -728,7 +728,7 @@ Use .wrc (wxWindows resource files) where possible, because they can be easily c
|
|||||||
independently of source code. Bitmap resources can be set up to load different
|
independently of source code. Bitmap resources can be set up to load different
|
||||||
kinds of bitmap depending on platform (see the section on resource files).
|
kinds of bitmap depending on platform (see the section on resource files).
|
||||||
|
|
||||||
\section{Strategies for debugging}
|
\section{Strategies for debugging}\label{debugstrategies}
|
||||||
|
|
||||||
\subsection{Positive thinking}
|
\subsection{Positive thinking}
|
||||||
|
|
||||||
@@ -757,49 +757,35 @@ to go from functioning to non-functioning state. This should give a clue
|
|||||||
to the problem. In some cases though, such as memory leaks or wrong
|
to the problem. In some cases though, such as memory leaks or wrong
|
||||||
deallocation, this can still give totally spurious results!
|
deallocation, this can still give totally spurious results!
|
||||||
|
|
||||||
\subsection{Genetic mutation}
|
|
||||||
|
|
||||||
If we had sophisticated genetic algorithm tools that could be applied
|
|
||||||
to programming, we could use them. Until then, a common -- if rather irrational --
|
|
||||||
technique is to just make arbitrary changes to the code until something
|
|
||||||
different happens. You may have an intuition why a change will make a difference;
|
|
||||||
otherwise, just try altering the order of code, comment lines out, anything
|
|
||||||
to get over an impasse. Obviously, this is usually a last resort.
|
|
||||||
|
|
||||||
\subsection{Use a debugger}
|
\subsection{Use a debugger}
|
||||||
|
|
||||||
This sounds like facetious advice, but it's surprising how often people
|
This sounds like facetious advice, but it's surprising how often people
|
||||||
don't use a debugger. Often it's an overhead to install or learn how to
|
don't use a debugger. Often it's an overhead to install or learn how to
|
||||||
use a debugger, but it really is essential for anything but the most
|
use a debugger, but it really is essential for anything but the most
|
||||||
trivial programs. Some platforms don't allow for debugging, such
|
trivial programs.
|
||||||
as WIN32s under Windows 3.x. In this case, you might be advised to
|
|
||||||
debug under 16-bit Windows and when you're confident, compile for
|
|
||||||
WIN32s. In fact WIN32s can be very strict about bad memory handling,
|
|
||||||
so testing out under WIN32s is a good thing to do even if you're
|
|
||||||
not going to distribute this version. (Unless you've got a good memory checking,
|
|
||||||
utility, of course!) Tracking bugs under WIN32s can involve a lot of debug message
|
|
||||||
insertion and relinking, so make sure your compiler has a fast linker
|
|
||||||
(e.g. Watcom, Symantec).
|
|
||||||
|
|
||||||
\subsection{Use tracing code}
|
\subsection{Use logging functions}
|
||||||
|
|
||||||
You can use wxDebugMsg statements (or the wxDebugStreamBuf class) to
|
There is a variety of logging functions that you can use in your program:
|
||||||
output to a debugging window such as DBWIN under Windows, or standard
|
see \helpref{Logging functions}{logfunctions}.
|
||||||
error under X. If compiling in DEBUG mode, you can use TRACE statements
|
|
||||||
that will be compiled out of the final build of your application.
|
|
||||||
|
|
||||||
Using tracing statements may be more convenient than using the debugger
|
Using tracing statements may be more convenient than using the debugger
|
||||||
in some circumstances (such as when your debugger doesn't support a lot
|
in some circumstances (such as when your debugger doesn't support a lot
|
||||||
of debugging code, or you wish to print a bunch of variables).
|
of debugging code, or you wish to print a bunch of variables).
|
||||||
|
|
||||||
\subsection{Use wxObject::Dump and the wxDebugContext class}
|
\subsection{Use the wxWindows debugging facilities}
|
||||||
|
|
||||||
It's good practice to implement the Dump member function for all
|
You can use wxDebugContext to check for
|
||||||
classes derived from wxObject. You can then make use of wxDebugContext
|
memory leaks and corrupt memory: in fact in debugging mode, wxWindows will
|
||||||
to dump out information on all objects in the program, if DEBUG is
|
automatically check for memory leaks at the end of the program if wxWindows is suitably
|
||||||
defined to be more than zero. You can use wxDebugContext to check for
|
configured. Depending on the operating system and compiler, more or less
|
||||||
memory leaks and corrupt memory. See the debugging topic in the
|
specific information about the problem will be logged.
|
||||||
reference manual for more information.
|
|
||||||
|
You should also use \helpref{debug macros}{debugmacros} as part of a `defensive programming' strategy,
|
||||||
|
scattering wxASSERTs liberally to test for problems in your code as early as possible. Forward thinking
|
||||||
|
will save a surprising amount of time in the long run.
|
||||||
|
|
||||||
|
See the \helpref{debugging overview}{debuggingoverview} for further information.
|
||||||
|
|
||||||
\subsection{Check Windows debug messages}
|
\subsection{Check Windows debug messages}
|
||||||
|
|
||||||
@@ -812,3 +798,14 @@ more problems. However, I doubt it's worth the hassle for most
|
|||||||
applications. wxWindows is designed to minimize the possibility of such
|
applications. wxWindows is designed to minimize the possibility of such
|
||||||
errors, but they can still happen occasionally, slipping through unnoticed
|
errors, but they can still happen occasionally, slipping through unnoticed
|
||||||
because they are not severe enough to cause a crash.
|
because they are not severe enough to cause a crash.
|
||||||
|
|
||||||
|
\subsection{Genetic mutation}
|
||||||
|
|
||||||
|
If we had sophisticated genetic algorithm tools that could be applied
|
||||||
|
to programming, we could use them. Until then, a common -- if rather irrational --
|
||||||
|
technique is to just make arbitrary changes to the code until something
|
||||||
|
different happens. You may have an intuition why a change will make a difference;
|
||||||
|
otherwise, just try altering the order of code, comment lines out, anything
|
||||||
|
to get over an impasse. Obviously, this is usually a last resort.
|
||||||
|
|
||||||
|
|
||||||
|
@@ -189,6 +189,8 @@ An event object contains information about a specific event. Event handlers
|
|||||||
|
|
||||||
{\large {\bf Validators}}
|
{\large {\bf Validators}}
|
||||||
|
|
||||||
|
\overview{Overview}{validatoroverview}
|
||||||
|
|
||||||
These are the window validators, used for filtering and validating
|
These are the window validators, used for filtering and validating
|
||||||
user input.
|
user input.
|
||||||
|
|
||||||
@@ -241,10 +243,11 @@ wxWindows supports some aspects of debugging an application through
|
|||||||
classes, functions and macros.
|
classes, functions and macros.
|
||||||
|
|
||||||
\begin{twocollist}\itemsep=0pt
|
\begin{twocollist}\itemsep=0pt
|
||||||
\twocolitem{\helpref{wxDebugContext}{wxdebugcontext}}{Provides various debugging facilities}
|
\twocolitem{\helpref{wxDebugContext}{wxdebugcontext}}{Provides memory-checking facilities}
|
||||||
%\twocolitem{\helpref{wxDebugStreamBuf}{wxdebugstreambuf}}{A stream buffer writing to the debug stream}
|
%\twocolitem{\helpref{wxDebugStreamBuf}{wxdebugstreambuf}}{A stream buffer writing to the debug stream}
|
||||||
\twocolitem{\helpref{wxLog}{wxlog}}{Logging facility}
|
\twocolitem{\helpref{wxLog}{wxlog}}{Logging facility}
|
||||||
\twocolitem{\helpref{Log functions}{logfunctions}}{Error and warning logging functions}
|
\twocolitem{\helpref{Log functions}{logfunctions}}{Error and warning logging functions}
|
||||||
|
\twocolitem{\helpref{Debugging macros}{debugmacros}}{Debug macros for assertion and checking}
|
||||||
%\twocolitem{\helpref{wxTrace}{wxtrace}}{Tracing facility}
|
%\twocolitem{\helpref{wxTrace}{wxtrace}}{Tracing facility}
|
||||||
%\twocolitem{\helpref{wxTraceLevel}{wxtracelevel}}{Tracing facility with levels}
|
%\twocolitem{\helpref{wxTraceLevel}{wxtracelevel}}{Tracing facility with levels}
|
||||||
\twocolitem{\helpref{WXDEBUG\_NEW}{debugnew}}{Use this macro to give further debugging information}
|
\twocolitem{\helpref{WXDEBUG\_NEW}{debugnew}}{Use this macro to give further debugging information}
|
||||||
|
@@ -13,8 +13,9 @@ when it starts, and immediately call {\bf Initialize}\rtfsp
|
|||||||
to associate a filename with it. The help viewer will only get run, however,
|
to associate a filename with it. The help viewer will only get run, however,
|
||||||
just before the first call to display something.
|
just before the first call to display something.
|
||||||
|
|
||||||
Although all classes actually derive from wxHelpControllerBase, the
|
Although all help controller classes actually derive from wxHelpControllerBase and have
|
||||||
appropriate class is aliased to wxHelpController for each platform.
|
names of the form wxXXXHelpController, the
|
||||||
|
appropriate class is aliased to the name wxHelpController for each platform.
|
||||||
|
|
||||||
There are currently the following help controller classes defined:
|
There are currently the following help controller classes defined:
|
||||||
|
|
||||||
|
@@ -40,7 +40,7 @@ bottom of the remaining client area. This scheme implies that order of window cr
|
|||||||
Say you wish to have an extra toolbar at the top of the frame, a project window to the left of
|
Say you wish to have an extra toolbar at the top of the frame, a project window to the left of
|
||||||
the MDI client window, and an output window above the status bar. You should therefore create
|
the MDI client window, and an output window above the status bar. You should therefore create
|
||||||
the windows in this order: toolbar, output window, project window. This ensures that the toolbar and
|
the windows in this order: toolbar, output window, project window. This ensures that the toolbar and
|
||||||
output window take up space at the top and bottom, then the remaining height in between is used for
|
output window take up space at the top and bottom, and then the remaining height inbetween is used for
|
||||||
the project window.
|
the project window.
|
||||||
|
|
||||||
wxLayoutAlgorithm is quite independent of the way in which
|
wxLayoutAlgorithm is quite independent of the way in which
|
||||||
|
@@ -51,8 +51,7 @@ drag was OK or out of the current allowed range.
|
|||||||
|
|
||||||
\wxheading{See also}
|
\wxheading{See also}
|
||||||
|
|
||||||
\helpref{wxWindow::OnSash}{wxwindowonactivate},\rtfsp
|
\helpref{wxSashWindow}{wxsashwindow},\rtfsp
|
||||||
\helpref{wxApp::OnSash}{wxapponactivate},\rtfsp
|
|
||||||
\helpref{Event handling overview}{eventhandlingoverview}
|
\helpref{Event handling overview}{eventhandlingoverview}
|
||||||
|
|
||||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||||
|
@@ -1,56 +1,84 @@
|
|||||||
\section{Debugging overview}\label{debuggingoverview}
|
\section{Debugging overview}\label{debuggingoverview}
|
||||||
|
|
||||||
Classes: \helpref{wxDebugContext}{wxdebugcontext}, \helpref{wxDebugStreamBuf}{wxdebugstreambuf},
|
Classes, functions and macros: \helpref{wxDebugContext}{wxdebugcontext}, \helpref{wxObject}{wxobject}, \helpref{wxLog}{wxlog},
|
||||||
\rtfsp\helpref{wxObject}{wxobject}
|
\rtfsp\helpref{Log functions}{logfunctions}, \helpref{Debug macros}{debugmacros}
|
||||||
|
|
||||||
Various classes, functions and macros are provided in wxWindows to help you debug
|
Various classes, functions and macros are provided in wxWindows to help you debug
|
||||||
your application. Most of these are only available if you compile both wxWindows,
|
your application. Most of these are only available if you compile both wxWindows,
|
||||||
your application and {\it all} libraries that use wxWindows with the DEBUG flag
|
your application and {\it all} libraries that use wxWindows with the \_\_WXDEBUG\_\_ symbol
|
||||||
set to 1 or more.
|
defined. You can also test the \_\_WXDEBUG\_\_ symbol in your own applications to execute
|
||||||
|
code that should be active only in debug mode.
|
||||||
|
|
||||||
wxDebugContext is a class that never gets instantiated, but ties together
|
\wxheading{wxDebugContext}
|
||||||
various functions and variables. It allows you to set the debugging stream, dump
|
|
||||||
all objects to that stream, write statistics about object allocation, and
|
\helpref{wxDebugContext}{wxdebugcontext} is a class that never gets instantiated, but ties together
|
||||||
|
various static functions and variables. It allows you to dump all objects to that stream, write statistics about object allocation, and
|
||||||
check memory for errors.
|
check memory for errors.
|
||||||
|
|
||||||
You can use the \helpref{WXTRACE}{trace} macro to output debugging information in DEBUG mode;
|
It is good practice to define a \helpref{wxObject::Dump}{wxobjectdump} member function for each class you derive
|
||||||
it will be defined to nothing for non-debugging code.
|
from a wxWindows class, so that \helpref{wxDebugContext::Dump}{wxdebugcontextdump} can call it and
|
||||||
|
|
||||||
It is good practice to define a Dump member function for each class you derive
|
|
||||||
from a wxWindows class, so that wxDebugContext::Dump can call it and
|
|
||||||
give valuable information about the state of the application.
|
give valuable information about the state of the application.
|
||||||
|
|
||||||
|
If you have difficulty tracking down a memory leak, recompile
|
||||||
|
in debugging mode and call \helpref{wxDebugContext::Dump}{wxdebugcontextdump} and \helpref{wxDebugContext::PrintStatistics}{wxdebugcontextprintstatistics} at
|
||||||
|
appropriate places. They will tell you what objects have not yet been
|
||||||
|
deleted, and what kinds of object they are. In fact, in debug mode wxWindows will automatically
|
||||||
|
detect memory leaks when your application is about to exit, and if there are any leaks,
|
||||||
|
will give you information about the problem. (How much information depends on the operating system
|
||||||
|
and compiler -- some systems don't allow all memory logging to be enabled). See the
|
||||||
|
memcheck sample for example of usage.
|
||||||
|
|
||||||
For wxDebugContext to do its work, the {\it new} and {\it delete}\rtfsp
|
For wxDebugContext to do its work, the {\it new} and {\it delete}\rtfsp
|
||||||
operators for wxObject have been redefined to store extra information
|
operators for wxObject have been redefined to store extra information
|
||||||
about dynamically allocated objects (but not statically declared
|
about dynamically allocated objects (but not statically declared
|
||||||
objects). This slows down a debugging version of an application, but can
|
objects). This slows down a debugging version of an application, but can
|
||||||
in theory find difficult-to-detect memory leaks (objects are not
|
find difficult-to-detect memory leaks (objects are not
|
||||||
deallocated), overwrites (writing past the end of your object) and
|
deallocated), overwrites (writing past the end of your object) and
|
||||||
underwrites (writing to memory in front of the object).
|
underwrites (writing to memory in front of the object).
|
||||||
|
|
||||||
If you have difficulty tracking down a memory leak, recompile
|
If debugging mode is on and the symbol wxUSE\_GLOBAL\_MEMORY\_OPERATORS is set
|
||||||
in debugging mode and call wxDebugContext::Dump and wxDebugContext::Statistics
|
to 1 in setup.h, 'new' is defined to be:
|
||||||
at appropriate places. They will tell you what objects have not yet been
|
|
||||||
deleted, and what kinds of object they are.
|
|
||||||
|
|
||||||
If you use the macro WXDEBUG\_NEW instead of the normal 'new', the debugging
|
|
||||||
output (and error messages reporting memory problems) will also tell you what
|
|
||||||
file and on what line you allocated the object.
|
|
||||||
|
|
||||||
To avoid the need for replacing existing new operators with WXDEBUG\_NEW, you
|
|
||||||
can write this at the top of each application file:
|
|
||||||
|
|
||||||
|
{\small
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
#define new WXDEBUG\_NEW
|
#define new new(__FILE__,__LINE__)
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
}%
|
||||||
|
|
||||||
In non-debugging mode, this will revert to the usual interpretation
|
All occurrences of 'new' in wxWindows and your own application will use
|
||||||
of new. Note that for this not to mess up new-based allocation of non-wxObject derived classes and
|
the overridden form of the operator with two extra arguments. This means that the debugging
|
||||||
built-in types, there are global definitions of new and delete which match
|
output (and error messages reporting memory problems) will tell you what
|
||||||
the syntax required for storing filename and line numbers. These merely
|
file and on what line you allocated the object. Unfortunately not all
|
||||||
call malloc and free, and so do not do anything interesting. The definitions
|
compilers allow this definition to work properly, but most do.
|
||||||
may possibly cause multiple symbol problems for some compilers and so might
|
|
||||||
need to be omitted by setting the USE\_GLOBAL\_MEMORY\_OPERATORS to 0 in wx\_setup.h
|
\wxheading{Debug macros}
|
||||||
|
|
||||||
|
You should also use \helpref{debug macros}{debugmacros} as part of a `defensive programming' strategy,
|
||||||
|
scattering wxASSERTs liberally to test for problems in your code as early as possible. Forward thinking
|
||||||
|
will save a surprising amount of time in the long run.
|
||||||
|
|
||||||
|
\helpref{wxASSERT}{wxassert} is used to pop up an error message box when a condition
|
||||||
|
is not true. You can also use \helpref{wxASSERT\_MSG}{wxassertmsg} to supply your
|
||||||
|
own helpful error message. For example:
|
||||||
|
|
||||||
|
{\small
|
||||||
|
\begin{verbatim}
|
||||||
|
void MyClass::MyFunction(wxObject* object)
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( (object != NULL), "object should not be NULL in MyFunction!" );
|
||||||
|
|
||||||
|
...
|
||||||
|
};
|
||||||
|
\end{verbatim}
|
||||||
|
}
|
||||||
|
|
||||||
|
The message box allows you to continue execution or abort the program. If you are running
|
||||||
|
the application inside a debugger, you will be able to see exactly where the problem was.
|
||||||
|
|
||||||
|
\wxheading{Logging functions}
|
||||||
|
|
||||||
|
You can use the \helpref{wxLogDebug}{wxlogdebug} and \helpref{wxLogTrace}{wxlogtrace} functions to output debugging information in debug mode;
|
||||||
|
it will do nothing for non-debugging code.
|
||||||
|
|
||||||
\subsection{wxDebugContext overview}\label{wxdebugcontextoverview}
|
\subsection{wxDebugContext overview}\label{wxdebugcontextoverview}
|
||||||
|
|
||||||
@@ -59,8 +87,7 @@ need to be omitted by setting the USE\_GLOBAL\_MEMORY\_OPERATORS to 0 in wx\_set
|
|||||||
Class: \helpref{wxDebugContext}{wxdebugcontext}
|
Class: \helpref{wxDebugContext}{wxdebugcontext}
|
||||||
|
|
||||||
wxDebugContext is a class for performing various debugging and memory tracing
|
wxDebugContext is a class for performing various debugging and memory tracing
|
||||||
operations. wxDebugContext, and the related macros and function WXTRACE and
|
operations.
|
||||||
wxTrace, are only present if USE\_DEBUG\_CONTEXT is used.
|
|
||||||
|
|
||||||
This class has only static data and function members, and there should be
|
This class has only static data and function members, and there should be
|
||||||
no instances. Probably the most useful members are SetFile (for directing output
|
no instances. Probably the most useful members are SetFile (for directing output
|
||||||
@@ -70,35 +97,26 @@ Dump (for dumping the dynamically allocated objects) and PrintStatistics
|
|||||||
Check to check memory blocks for integrity.
|
Check to check memory blocks for integrity.
|
||||||
|
|
||||||
Here's an example of use. The SetCheckpoint ensures that only the
|
Here's an example of use. The SetCheckpoint ensures that only the
|
||||||
allocations done after the checkpoint will be dumped. Unfortunately
|
allocations done after the checkpoint will be dumped.
|
||||||
the define of new to WXDEBUG\_NEW does not work for Borland C++ (and
|
|
||||||
perhaps other compilers) because it fails to find the correct overloaded
|
|
||||||
operator for non-object usage of new. Instead, you need to use WXDEBUG\_NEW
|
|
||||||
explicitly if there are any examples of non-object new usage in the file.
|
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
#define new WXDEBUG_NEW
|
|
||||||
|
|
||||||
wxDebugContext::SetCheckpoint();
|
wxDebugContext::SetCheckpoint();
|
||||||
|
|
||||||
wxDebugContext::SetFile("c:\\temp\\debug.log");
|
wxDebugContext::SetFile("c:\\temp\\debug.log");
|
||||||
|
|
||||||
wxString *thing = new wxString;
|
wxString *thing = new wxString;
|
||||||
|
|
||||||
// Proves that defining 'new' to be 'WXDEBUG_NEW' doesn't mess up
|
|
||||||
// non-object allocation. Doesn't work for Borland C++.
|
|
||||||
char *ordinaryNonObject = new char[1000];
|
char *ordinaryNonObject = new char[1000];
|
||||||
|
|
||||||
wxDebugContext::Dump();
|
wxDebugContext::Dump();
|
||||||
wxDebugContext::PrintStatistics();
|
wxDebugContext::PrintStatistics();
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
You can use wxDebugContext if DEBUG is 1 or more, or you can use it
|
You can use wxDebugContext if \_\_WXDEBUG\_\_ is defined, or you can use it
|
||||||
at any other time (if USE\_DEBUG\_CONTEXT is 1). It is not disabled
|
at any other time (if wxUSE\_DEBUG\_CONTEXT is set to 1 in setup.h). It is not disabled
|
||||||
for DEBUG = 1 (as in earlier versions of wxWindows) because you
|
in non-debug mode because you may not wish to recompile wxWindows and your entire application
|
||||||
may not wish to recompile wxWindows and your entire application
|
just to make use of the error logging facility.
|
||||||
just to make use of the error logging facility. This is especially
|
|
||||||
true in a Windows NT or Windows 95 environment, where you cannot
|
Note: wxDebugContext::SetFile has a problem at present, so use the default stream instead.
|
||||||
easily output to a debug window: wxDebugContext can be used to
|
Eventually the logging will be done through the wxLog facilities instead.
|
||||||
write to log files instead.
|
|
||||||
|
|
||||||
|
@@ -8,10 +8,13 @@ Another is that instances of a class cannot be created just by knowing the name
|
|||||||
which makes facilities such as persistent storage hard to implement.
|
which makes facilities such as persistent storage hard to implement.
|
||||||
|
|
||||||
Most C++ GUI frameworks overcome these limitations by means of a set of
|
Most C++ GUI frameworks overcome these limitations by means of a set of
|
||||||
macros and functions and wxWindows (from version 1.62) is no exception.
|
macros and functions and wxWindows is no exception.
|
||||||
Each class that you wish to be known the type system should have
|
Each class that you wish to be known the type system should have
|
||||||
a macro such as DECLARE\_DYNAMIC\_CLASS just inside the class declaration.
|
a macro such as DECLARE\_DYNAMIC\_CLASS just inside the class declaration.
|
||||||
The macro IMPLEMENT\_DYNAMIC\_CLASS should be in the implementation file.
|
The macro IMPLEMENT\_DYNAMIC\_CLASS should be in the implementation file.
|
||||||
|
Note that these are entirely optional; use them if you wish to check object
|
||||||
|
types, or create instances of classes using the class name. However,
|
||||||
|
it is good to get into the habit of adding these macros for all classes.
|
||||||
|
|
||||||
Variations on these \helpref{macros}{macros} are used for multiple inheritance, and abstract
|
Variations on these \helpref{macros}{macros} are used for multiple inheritance, and abstract
|
||||||
classes that cannot be instantiated dynamically or otherwise.
|
classes that cannot be instantiated dynamically or otherwise.
|
||||||
|
@@ -41,19 +41,14 @@
|
|||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
|
|
||||||
// #ifndef WXDEBUG_NEW
|
|
||||||
// #define WXDEBUG_NEW new(__FILE__,__LINE__)
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
void * wxDebugAlloc(size_t size, char * fileName, int lineNum, bool isObject, bool isVect = FALSE);
|
void * wxDebugAlloc(size_t size, char * fileName, int lineNum, bool isObject, bool isVect = FALSE);
|
||||||
void wxDebugFree(void * buf, bool isVect = FALSE);
|
void wxDebugFree(void * buf, bool isVect = FALSE);
|
||||||
|
|
||||||
// Global versions of the new and delete operators.
|
// Global versions of the new and delete operators.
|
||||||
// Currently, these merely call malloc and free; only the wxObject
|
|
||||||
// operators do something interesting. But this allows WXDEBUG_NEW to
|
|
||||||
// work for all 'new's in a file.
|
|
||||||
#if wxUSE_GLOBAL_MEMORY_OPERATORS
|
#if wxUSE_GLOBAL_MEMORY_OPERATORS
|
||||||
|
|
||||||
|
// Undefine temporarily (new is #defined in object.h) because we want to
|
||||||
|
// declare some new operators.
|
||||||
#ifdef new
|
#ifdef new
|
||||||
#undef new
|
#undef new
|
||||||
#endif
|
#endif
|
||||||
@@ -264,14 +259,14 @@ private:
|
|||||||
static bool m_checkPrevious;
|
static bool m_checkPrevious;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Output a debug mess., in a system dependent fashion.
|
// Output a debug message, in a system dependent fashion.
|
||||||
void WXDLLEXPORT wxTrace(const char *fmt ...);
|
void WXDLLEXPORT wxTrace(const char *fmt ...);
|
||||||
void WXDLLEXPORT wxTraceLevel(int level, const char *fmt ...);
|
void WXDLLEXPORT wxTraceLevel(int level, const char *fmt ...);
|
||||||
|
|
||||||
#define WXTRACE wxTrace
|
#define WXTRACE wxTrace
|
||||||
#define WXTRACELEVEL wxTraceLevel
|
#define WXTRACELEVEL wxTraceLevel
|
||||||
|
|
||||||
#else // else part for the #if WXDEBUG
|
#else // else part for the #if __WXDEBUG__
|
||||||
|
|
||||||
inline void wxTrace(const char *WXUNUSED(fmt)) {}
|
inline void wxTrace(const char *WXUNUSED(fmt)) {}
|
||||||
inline void wxTraceLevel(int WXUNUSED(level), const char *WXUNUSED(fmt)) {}
|
inline void wxTraceLevel(int WXUNUSED(level), const char *WXUNUSED(fmt)) {}
|
||||||
|
@@ -247,6 +247,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if defined(__WXDEBUG__) && wxUSE_GLOBAL_MEMORY_OPERATORS
|
#if defined(__WXDEBUG__) && wxUSE_GLOBAL_MEMORY_OPERATORS
|
||||||
|
// JACS: not necessary now that new can be defined globally
|
||||||
//#ifndef WXDEBUG_NEW
|
//#ifndef WXDEBUG_NEW
|
||||||
//#define WXDEBUG_NEW new(__FILE__,__LINE__)
|
//#define WXDEBUG_NEW new(__FILE__,__LINE__)
|
||||||
//#endif
|
//#endif
|
||||||
|
@@ -31,8 +31,8 @@
|
|||||||
#include "mondrian.xpm"
|
#include "mondrian.xpm"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !WXDEBUG
|
#ifndef __WXDEBUG__
|
||||||
#error You must set WXDEBUG to 1 on the 'make' command line (MSW) or with configure (GTK)
|
#error This program must be compiled in debug mode.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Define a new application type
|
// Define a new application type
|
||||||
@@ -82,7 +82,7 @@ bool MyApp::OnInit(void)
|
|||||||
frame->Show(TRUE);
|
frame->Show(TRUE);
|
||||||
|
|
||||||
wxDebugContext::SetCheckpoint();
|
wxDebugContext::SetCheckpoint();
|
||||||
wxDebugContext::SetFile("debug.log");
|
// wxDebugContext::SetFile("debug.log");
|
||||||
|
|
||||||
wxString *thing = new wxString;
|
wxString *thing = new wxString;
|
||||||
wxDate* date = new wxDate;
|
wxDate* date = new wxDate;
|
||||||
@@ -96,7 +96,7 @@ bool MyApp::OnInit(void)
|
|||||||
wxDebugContext::Dump();
|
wxDebugContext::Dump();
|
||||||
wxDebugContext::PrintStatistics();
|
wxDebugContext::PrintStatistics();
|
||||||
|
|
||||||
// Don't delete these two objects, to force wxApp to flag a memory leak.
|
// Don't delete these objects, to force wxApp to flag a memory leak.
|
||||||
// delete thing;
|
// delete thing;
|
||||||
// delete date;
|
// delete date;
|
||||||
// delete[] ordinaryNonObject;
|
// delete[] ordinaryNonObject;
|
||||||
|
@@ -55,12 +55,6 @@
|
|||||||
|
|
||||||
#ifdef __GNUWIN32__
|
#ifdef __GNUWIN32__
|
||||||
#include <sys/unistd.h>
|
#include <sys/unistd.h>
|
||||||
// #include <sys/stat.h>
|
|
||||||
|
|
||||||
#ifndef __MINGW32__
|
|
||||||
#include <std.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define stricmp strcasecmp
|
#define stricmp strcasecmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -214,11 +208,18 @@ wxString wxPathList::FindAbsoluteValidPath (const wxString& file)
|
|||||||
bool
|
bool
|
||||||
wxFileExists (const wxString& filename)
|
wxFileExists (const wxString& filename)
|
||||||
{
|
{
|
||||||
|
#ifdef __GNUWIN32__ // (fix a B20 bug)
|
||||||
|
if (GetFileAttributes(filename) == 0xFFFFFFFF)
|
||||||
|
return FALSE;
|
||||||
|
else
|
||||||
|
return TRUE;
|
||||||
|
#else
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
|
|
||||||
if (filename && stat ((char *)(const char *)filename, &stbuf) == 0)
|
if (filename && stat ((char *)(const char *)filename, &stbuf) == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Vadim's alternative implementation
|
/* Vadim's alternative implementation
|
||||||
|
@@ -39,8 +39,8 @@ MAKE=make
|
|||||||
LEX=flex.exe -t -L
|
LEX=flex.exe -t -L
|
||||||
|
|
||||||
# YACC. byacc or bison
|
# YACC. byacc or bison
|
||||||
YACC=byacc.exe
|
# YACC=byacc.exe
|
||||||
# YACC=bison.exe
|
YACC=bison.exe
|
||||||
|
|
||||||
# Resource compiler
|
# Resource compiler
|
||||||
RESCOMP=windres.exe
|
RESCOMP=windres.exe
|
||||||
@@ -57,15 +57,6 @@ OPTIONS= # -D__MINGW32__ # -D__EGCS__
|
|||||||
# IRIX: -g3
|
# IRIX: -g3
|
||||||
DEBUGFLAGS = -ggdb -D__WXDEBUG__
|
DEBUGFLAGS = -ggdb -D__WXDEBUG__
|
||||||
|
|
||||||
# Debug/trace mode. 1 or more for memory debugging.
|
|
||||||
# Unfortunately this doesn't seem to work with GnuWin32 - get warning:
|
|
||||||
# ../../include/wx/memory.h:58: warning: declaration of `operator delete(void *)'
|
|
||||||
# throws different exceptions
|
|
||||||
# <internal>:58: warning: previous declaration here
|
|
||||||
# So setting to 0 for now.
|
|
||||||
|
|
||||||
WXDEBUG=0
|
|
||||||
|
|
||||||
WIN95=1
|
WIN95=1
|
||||||
|
|
||||||
ifeq ($(WIN95),0)
|
ifeq ($(WIN95),0)
|
||||||
@@ -143,8 +134,8 @@ LDLIBS = $(LIBS)
|
|||||||
OBJDIR = objects$(GUISUFFIX)
|
OBJDIR = objects$(GUISUFFIX)
|
||||||
|
|
||||||
# You shouldn't need to change these...
|
# You shouldn't need to change these...
|
||||||
CPPFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) $(DEBUGFLAGS) -DWXDEBUG='$(WXDEBUG)' $(WARN) $(OPT)
|
CPPFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT)
|
||||||
CFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) $(DEBUGFLAGS) -DWXDEBUG='$(WXDEBUG)' $(WARN) $(OPT)
|
CFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT)
|
||||||
LDFLAGS = -Wl,--subsystem,windows -mwindows -L$(WXDIR)/lib
|
LDFLAGS = -Wl,--subsystem,windows -mwindows -L$(WXDIR)/lib
|
||||||
|
|
||||||
.SUFFIXES: .rc .$(RESSUFF) .$(RSCSUFF) .cpp .c
|
.SUFFIXES: .rc .$(RESSUFF) .$(RSCSUFF) .cpp .c
|
||||||
|
@@ -51,7 +51,21 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __SVR4__
|
||||||
|
#include <sys/systeminfo.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __SOLARIS__
|
||||||
|
// somehow missing from sys/wait.h but in the system's docs
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
pid_t wait4(pid_t pid, int *statusp, int options, struct rusage
|
||||||
|
*rusage);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <Xm/Xm.h>
|
#include <Xm/Xm.h>
|
||||||
|
|
||||||
@@ -82,7 +96,7 @@ void xt_notify_end_process(XtPointer client, int *fid,
|
|||||||
/* wait4 is not part of any standard, use at own risk
|
/* wait4 is not part of any standard, use at own risk
|
||||||
* not sure what wait4 does, but wait3 seems to be closest, whats a digit ;-)
|
* not sure what wait4 does, but wait3 seems to be closest, whats a digit ;-)
|
||||||
* --- offer@sgi.com */
|
* --- offer@sgi.com */
|
||||||
#if !defined(__sgi)
|
#if !defined(__sgi) && !defined(__ALPHA__)
|
||||||
wait4(process_data->pid, NULL, 0, NULL);
|
wait4(process_data->pid, NULL, 0, NULL);
|
||||||
#else
|
#else
|
||||||
wait3((int *) NULL, 0, (rusage *) NULL);
|
wait3((int *) NULL, 0, (rusage *) NULL);
|
||||||
|
@@ -64,7 +64,6 @@ GENERICOBJS= \
|
|||||||
$(GENDIR)/colrdlgg.$(OBJSUFF) \
|
$(GENDIR)/colrdlgg.$(OBJSUFF) \
|
||||||
$(GENDIR)/fontdlgg.$(OBJSUFF) \
|
$(GENDIR)/fontdlgg.$(OBJSUFF) \
|
||||||
$(GENDIR)/gridg.$(OBJSUFF) \
|
$(GENDIR)/gridg.$(OBJSUFF) \
|
||||||
$(GENDIR)/helpxlp.$(OBJSUFF) \
|
|
||||||
$(GENDIR)/laywin.$(OBJSUFF) \
|
$(GENDIR)/laywin.$(OBJSUFF) \
|
||||||
$(GENDIR)/msgdlgg.$(OBJSUFF) \
|
$(GENDIR)/msgdlgg.$(OBJSUFF) \
|
||||||
$(GENDIR)/panelg.$(OBJSUFF) \
|
$(GENDIR)/panelg.$(OBJSUFF) \
|
||||||
@@ -124,19 +123,22 @@ COMMONOBJS = \
|
|||||||
$(COMMDIR)/datstrm.$(OBJSUFF) \
|
$(COMMDIR)/datstrm.$(OBJSUFF) \
|
||||||
$(COMMDIR)/objstrm.$(OBJSUFF) \
|
$(COMMDIR)/objstrm.$(OBJSUFF) \
|
||||||
$(COMMDIR)/extended.$(OBJSUFF) \
|
$(COMMDIR)/extended.$(OBJSUFF) \
|
||||||
|
$(COMMDIR)/socket.$(OBJSUFF) \
|
||||||
|
$(COMMDIR)/sckaddr.$(OBJSUFF) \
|
||||||
|
$(COMMDIR)/sckfile.$(OBJSUFF) \
|
||||||
|
$(COMMDIR)/sckipc.$(OBJSUFF) \
|
||||||
|
$(COMMDIR)/sckstrm.$(OBJSUFF) \
|
||||||
|
$(COMMDIR)/protocol.$(OBJSUFF) \
|
||||||
|
$(COMMDIR)/http.$(OBJSUFF) \
|
||||||
|
$(COMMDIR)/ftp.$(OBJSUFF) \
|
||||||
|
$(COMMDIR)/url.$(OBJSUFF) \
|
||||||
$(COMMDIR)/wincmn.$(OBJSUFF)
|
$(COMMDIR)/wincmn.$(OBJSUFF)
|
||||||
|
|
||||||
# Unfortunately, GnuWin32 fails with a syntax error in Sockets.h,
|
# This must be renamed! It conflicts with the g++ fstream.h.
|
||||||
# so remove socket code.
|
# $(COMMDIR)/fstream.$(OBJSUFF) \
|
||||||
# $(COMMDIR)/socket.$(OBJSUFF) \
|
|
||||||
# $(COMMDIR)/sckaddr.$(OBJSUFF) \
|
# NOTE: if the socket-related files above fail with a syntax error in Sockets.h,
|
||||||
# $(COMMDIR)/sckfile.$(OBJSUFF) \
|
# remove the files (probably all GnuWin32 releases < b20).
|
||||||
# $(COMMDIR)/sckipc.$(OBJSUFF) \
|
|
||||||
# $(COMMDIR)/sckstrm.$(OBJSUFF) \
|
|
||||||
# $(COMMDIR)/protocol.$(OBJSUFF) \
|
|
||||||
# $(COMMDIR)/http.$(OBJSUFF) \
|
|
||||||
# $(COMMDIR)/ftp.$(OBJSUFF) \
|
|
||||||
# $(COMMDIR)/url.$(OBJSUFF) \
|
|
||||||
|
|
||||||
MSWOBJS = \
|
MSWOBJS = \
|
||||||
accel.$(OBJSUFF) \
|
accel.$(OBJSUFF) \
|
||||||
|
@@ -194,7 +194,7 @@ wxRegKey::wxRegKey()
|
|||||||
wxRegKey::wxRegKey(const wxString& strKey) : m_strKey(strKey)
|
wxRegKey::wxRegKey(const wxString& strKey) : m_strKey(strKey)
|
||||||
{
|
{
|
||||||
m_hRootKey = (WXHKEY) aStdKeys[ExtractKeyName(m_strKey)].hkey;
|
m_hRootKey = (WXHKEY) aStdKeys[ExtractKeyName(m_strKey)].hkey;
|
||||||
m_hKey = NULL;
|
m_hKey = (WXHKEY) NULL;
|
||||||
m_dwLastError = 0;
|
m_dwLastError = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ wxRegKey::wxRegKey(StdKey keyParent, const wxString& strKey) : m_strKey(strKey)
|
|||||||
{
|
{
|
||||||
RemoveTrailingSeparator(m_strKey);
|
RemoveTrailingSeparator(m_strKey);
|
||||||
m_hRootKey = (WXHKEY) aStdKeys[keyParent].hkey;
|
m_hRootKey = (WXHKEY) aStdKeys[keyParent].hkey;
|
||||||
m_hKey = NULL;
|
m_hKey = (WXHKEY) NULL;
|
||||||
m_dwLastError = 0;
|
m_dwLastError = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ wxRegKey::wxRegKey(const wxRegKey& keyParent, const wxString& strKey)
|
|||||||
RemoveTrailingSeparator(m_strKey);
|
RemoveTrailingSeparator(m_strKey);
|
||||||
|
|
||||||
m_hRootKey = keyParent.m_hRootKey;
|
m_hRootKey = keyParent.m_hRootKey;
|
||||||
m_hKey = NULL;
|
m_hKey = (WXHKEY) NULL;
|
||||||
m_dwLastError = 0;
|
m_dwLastError = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,7 +562,7 @@ wxRegKey::ValueType wxRegKey::GetValueType(const char *szValue)
|
|||||||
bool wxRegKey::SetValue(const char *szValue, long lValue)
|
bool wxRegKey::SetValue(const char *szValue, long lValue)
|
||||||
{
|
{
|
||||||
if ( CONST_CAST Open() ) {
|
if ( CONST_CAST Open() ) {
|
||||||
m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, RESERVED, REG_DWORD,
|
m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_DWORD,
|
||||||
(RegString)&lValue, sizeof(lValue));
|
(RegString)&lValue, sizeof(lValue));
|
||||||
if ( m_dwLastError == ERROR_SUCCESS )
|
if ( m_dwLastError == ERROR_SUCCESS )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -640,7 +640,7 @@ bool wxRegKey::SetValue(const char *szValue, const wxString& strValue)
|
|||||||
{
|
{
|
||||||
if ( CONST_CAST Open() ) {
|
if ( CONST_CAST Open() ) {
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, RESERVED, REG_SZ,
|
m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_SZ,
|
||||||
(RegString)strValue.c_str(),
|
(RegString)strValue.c_str(),
|
||||||
strValue.Len() + 1);
|
strValue.Len() + 1);
|
||||||
if ( m_dwLastError == ERROR_SUCCESS )
|
if ( m_dwLastError == ERROR_SUCCESS )
|
||||||
|
@@ -467,7 +467,7 @@ wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent,
|
|||||||
mask |= TVIF_IMAGE;
|
mask |= TVIF_IMAGE;
|
||||||
tvIns.item.iImage = image;
|
tvIns.item.iImage = image;
|
||||||
|
|
||||||
if ( selectedImage = -1 )
|
if ( selectedImage == -1 )
|
||||||
{
|
{
|
||||||
// take the same image for selected icon if not specified
|
// take the same image for selected icon if not specified
|
||||||
selectedImage = image;
|
selectedImage = image;
|
||||||
|
@@ -40,10 +40,6 @@
|
|||||||
#ifdef __GNUWIN32__
|
#ifdef __GNUWIN32__
|
||||||
#include <sys/unistd.h>
|
#include <sys/unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#ifndef __MINGW32__
|
|
||||||
#include <std.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
|
@@ -187,6 +187,7 @@ void wxPropertyFormView::OnOk(wxCommandEvent& WXUNUSED(event))
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
sm_dialogCancelled = FALSE;
|
sm_dialogCancelled = FALSE;
|
||||||
|
TransferToPropertySheet();
|
||||||
|
|
||||||
m_managedWindow->Close(TRUE);
|
m_managedWindow->Close(TRUE);
|
||||||
}
|
}
|
||||||
@@ -204,6 +205,7 @@ void wxPropertyFormView::OnHelp(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void wxPropertyFormView::OnUpdate(wxCommandEvent& WXUNUSED(event))
|
void wxPropertyFormView::OnUpdate(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
if (Check())
|
||||||
TransferToPropertySheet();
|
TransferToPropertySheet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user