Include wx/math.h according to precompiled headers of wx/wx.h (with other minor cleaning).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39745 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2006-06-15 17:58:49 +00:00
parent 0d1c8f39ba
commit 18680f8651
46 changed files with 238 additions and 237 deletions

View File

@@ -26,6 +26,7 @@
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/stream.h" #include "wx/stream.h"
#include "wx/memory.h" #include "wx/memory.h"
#include "wx/math.h"
#if wxUSE_GUI #if wxUSE_GUI

View File

@@ -15,6 +15,7 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/log.h" #include "wx/log.h"
#include "wx/math.h" //math constants
#endif //WX_PRECOMP #endif //WX_PRECOMP
#include "wx/cocoa/autorelease.h" #include "wx/cocoa/autorelease.h"
@@ -30,7 +31,6 @@
#import <AppKit/NSTypesetter.h> #import <AppKit/NSTypesetter.h>
#import <AppKit/NSImage.h> #import <AppKit/NSImage.h>
#include "wx/math.h" //math constants
#include "wx/listimpl.cpp" #include "wx/listimpl.cpp"
WX_DEFINE_LIST(wxCocoaDCStack); WX_DEFINE_LIST(wxCocoaDCStack);

View File

@@ -32,12 +32,12 @@
#include "wx/app.h" #include "wx/app.h"
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/arrstr.h" #include "wx/arrstr.h"
#include "wx/math.h"
#endif //WX_PRECOMP #endif //WX_PRECOMP
#if wxUSE_CONFIG && ((wxUSE_FILE && wxUSE_TEXTFILE) || wxUSE_CONFIG_NATIVE) #if wxUSE_CONFIG && ((wxUSE_FILE && wxUSE_TEXTFILE) || wxUSE_CONFIG_NATIVE)
#include "wx/file.h" #include "wx/file.h"
#include "wx/math.h"
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>

View File

@@ -19,7 +19,10 @@
#if wxUSE_STREAMS #if wxUSE_STREAMS
#include "wx/datstrm.h" #include "wx/datstrm.h"
#include "wx/math.h"
#ifndef WX_PRECOMP
#include "wx/math.h"
#endif //WX_PRECOMP
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// wxDataInputStream // wxDataInputStream

View File

@@ -25,7 +25,10 @@
#endif #endif
#include "wx/dc.h" #include "wx/dc.h"
#include "wx/math.h"
#ifndef WX_PRECOMP
#include "wx/math.h"
#endif
// bool wxDCBase::sm_cacheing = false; // bool wxDCBase::sm_cacheing = false;
@@ -414,7 +417,7 @@ bool wxDCBase::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths)
{ {
int totalWidth = 0; int totalWidth = 0;
const size_t len = text.Length(); const size_t len = text.length();
widths.Empty(); widths.Empty();
widths.Add(0, len); widths.Add(0, len);

View File

@@ -24,13 +24,13 @@
#include "wx/hash.h" #include "wx/hash.h"
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/bitmap.h" #include "wx/bitmap.h"
#include "wx/math.h"
#endif #endif
#include "wx/filefn.h" #include "wx/filefn.h"
#include "wx/wfstream.h" #include "wx/wfstream.h"
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/module.h" #include "wx/module.h"
#include "wx/math.h"
#if wxUSE_XPM #if wxUSE_XPM
#include "wx/xpmdecod.h" #include "wx/xpmdecod.h"

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: wx/longlong.cpp // Name: src/common/longlong.cpp
// Purpose: implementation of wxLongLongNative // Purpose: implementation of wxLongLongNative
// Author: Jeffrey C. Ollie <jeff@ollie.clive.ia.us>, Vadim Zeitlin // Author: Jeffrey C. Ollie <jeff@ollie.clive.ia.us>, Vadim Zeitlin
// Remarks: this class is not public in wxWidgets 2.0! It is intentionally // Remarks: this class is not public in wxWidgets 2.0! It is intentionally
@@ -22,17 +22,21 @@
#endif #endif
#if wxUSE_LONGLONG #if wxUSE_LONGLONG
#include "wx/longlong.h" #include "wx/longlong.h"
#include "wx/math.h" // for fabs()
#ifndef WX_PRECOMP
#include "wx/math.h" // for fabs()
#endif
#if wxUSE_STREAMS #if wxUSE_STREAMS
#include "wx/txtstrm.h" #include "wx/txtstrm.h"
#endif #endif
#if defined(__MWERKS__) && defined(__WXMSW__) #if defined(__MWERKS__) && defined(__WXMSW__)
#include <string.h> // for memset() #include <string.h> // for memset()
#else #else
#include <memory.h> // for memset() #include <memory.h> // for memset()
#endif #endif
#include "wx/ioswrap.h" #include "wx/ioswrap.h"
@@ -1257,7 +1261,7 @@ WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &o,
wxString s = o.ReadWord(); wxString s = o.ReadWord();
ll = wxULongLong(0l, 0l); ll = wxULongLong(0l, 0l);
size_t length = s.Length(); size_t length = s.length();
size_t idx = 0; size_t idx = 0;
wxChar ch = READ_STRING_CHAR(s, idx, length); wxChar ch = READ_STRING_CHAR(s, idx, length);
@@ -1282,7 +1286,7 @@ WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &o,
wxString s = o.ReadWord(); wxString s = o.ReadWord();
ll = wxLongLong(0l, 0l); ll = wxLongLong(0l, 0l);
size_t length = s.Length(); size_t length = s.length();
size_t idx = 0; size_t idx = 0;
wxChar ch = READ_STRING_CHAR(s, idx, length); wxChar ch = READ_STRING_CHAR(s, idx, length);

View File

@@ -16,15 +16,15 @@
#include "wx/wxprec.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#include "wx/matrix.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/math.h" #include "wx/math.h"
#endif #endif
#include "wx/matrix.h"
static const double pi = M_PI; static const double pi = M_PI;
wxTransformMatrix::wxTransformMatrix(void) wxTransformMatrix::wxTransformMatrix(void)

View File

@@ -20,6 +20,7 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/string.h" #include "wx/string.h"
#include "wx/math.h"
#if wxUSE_STREAMS #if wxUSE_STREAMS
#include "wx/stream.h" #include "wx/stream.h"
#endif #endif
@@ -44,7 +45,6 @@ using namespace std ;
#include "wx/string.h" #include "wx/string.h"
#include "wx/tokenzr.h" #include "wx/tokenzr.h"
#include "wx/math.h"
IMPLEMENT_ABSTRACT_CLASS(wxVariantData, wxObject) IMPLEMENT_ABSTRACT_CLASS(wxVariantData, wxObject)

View File

@@ -25,6 +25,7 @@
#include "wx/app.h" #include "wx/app.h"
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/math.h"
#endif // WX_PRECOMP #endif // WX_PRECOMP
#include "wx/image.h" #include "wx/image.h"
@@ -32,7 +33,6 @@
#include "wx/generic/prntdlgg.h" #include "wx/generic/prntdlgg.h"
#include "wx/paper.h" #include "wx/paper.h"
#include "wx/filefn.h" #include "wx/filefn.h"
#include "wx/math.h"
#include "wx/stdpaths.h" #include "wx/stdpaths.h"
WXDLLIMPEXP_DATA_CORE(int) wxPageNumber; WXDLLIMPEXP_DATA_CORE(int) wxPageNumber;

View File

@@ -50,11 +50,11 @@
#include "wx/dcscreen.h" #include "wx/dcscreen.h"
#include "wx/textctrl.h" #include "wx/textctrl.h"
#include "wx/listbox.h" #include "wx/listbox.h"
#include "wx/math.h"
#endif #endif
#include "wx/selstore.h" #include "wx/selstore.h"
#include "wx/renderer.h" #include "wx/renderer.h"
#include "wx/math.h"
#ifdef __WXMAC__ #ifdef __WXMAC__
#include "wx/mac/private.h" #include "wx/mac/private.h"

View File

@@ -28,10 +28,9 @@
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/dcscreen.h" #include "wx/dcscreen.h"
#include "wx/math.h"
#endif #endif
#include "wx/math.h"
#include <stdlib.h> #include <stdlib.h>
#include "wx/laywin.h" #include "wx/laywin.h"

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: tabg.cpp // Name: src/generic/tabg.cpp
// Purpose: Generic tabbed dialogs // Purpose: Generic tabbed dialogs
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
@@ -13,7 +13,7 @@
#include "wx/wxprec.h" #include "wx/wxprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#if wxUSE_TAB_DIALOG #if wxUSE_TAB_DIALOG
@@ -22,13 +22,13 @@
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/math.h"
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include "wx/math.h"
#include "wx/tab.h" #include "wx/tab.h"
#include "wx/listimpl.cpp" #include "wx/listimpl.cpp"

View File

@@ -17,6 +17,7 @@
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/palette.h" #include "wx/palette.h"
#include "wx/icon.h" #include "wx/icon.h"
#include "wx/math.h"
#endif #endif
#include "wx/filefn.h" #include "wx/filefn.h"
@@ -32,8 +33,6 @@
#include <gdk/gdkimage.h> #include <gdk/gdkimage.h>
#include "wx/math.h"
extern void gdk_wx_draw_bitmap (GdkDrawable *drawable, extern void gdk_wx_draw_bitmap (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,
GdkDrawable *src, GdkDrawable *src,

View File

@@ -19,6 +19,7 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/log.h" #include "wx/log.h"
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/math.h" // for floating-point functions
#endif #endif
#include "wx/image.h" #include "wx/image.h"
@@ -28,8 +29,6 @@
#include "wx/gtk/win_gtk.h" #include "wx/gtk/win_gtk.h"
#include "wx/gtk/private.h" #include "wx/gtk/private.h"
#include "wx/math.h" // for floating-point functions
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <gdk/gdkprivate.h> #include <gdk/gdkprivate.h>

View File

@@ -23,9 +23,9 @@
#include "wx/log.h" #include "wx/log.h"
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/icon.h" #include "wx/icon.h"
#include "wx/math.h"
#endif #endif
#include "wx/math.h"
#include "wx/fontutil.h" #include "wx/fontutil.h"
#include "wx/gtk/private.h" #include "wx/gtk/private.h"
#include "wx/module.h" #include "wx/module.h"

View File

@@ -18,16 +18,15 @@
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/panel.h" #include "wx/panel.h"
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/math.h"
#endif #endif
#include "wx/math.h"
#include "wx/strconv.h" #include "wx/strconv.h"
#include "wx/fontutil.h" // for wxNativeFontInfo (GetNativeFontInfo()) #include "wx/fontutil.h" // for wxNativeFontInfo (GetNativeFontInfo())
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <ctype.h> #include <ctype.h>
#include "wx/math.h"
#include "wx/gtk/private.h" #include "wx/gtk/private.h"
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>

View File

@@ -32,6 +32,7 @@
#include "wx/combobox.h" #include "wx/combobox.h"
#include "wx/layout.h" #include "wx/layout.h"
#include "wx/statusbr.h" #include "wx/statusbr.h"
#include "wx/math.h"
#endif #endif
#include "wx/module.h" #include "wx/module.h"
@@ -54,7 +55,6 @@
#include "wx/thread.h" #include "wx/thread.h"
#endif #endif
#include "wx/math.h"
#include <ctype.h> #include <ctype.h>
// FIXME: Due to a hack we use GtkCombo in here, which is deprecated since gtk2.3.0 // FIXME: Due to a hack we use GtkCombo in here, which is deprecated since gtk2.3.0

View File

@@ -17,6 +17,7 @@
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/palette.h" #include "wx/palette.h"
#include "wx/icon.h" #include "wx/icon.h"
#include "wx/math.h"
#endif // WX_PRECOMP #endif // WX_PRECOMP
#include "wx/filefn.h" #include "wx/filefn.h"
@@ -28,8 +29,6 @@
#include <gdk/gdkrgb.h> #include <gdk/gdkrgb.h>
#include "wx/math.h"
extern extern
void gdk_wx_draw_bitmap (GdkDrawable *drawable, void gdk_wx_draw_bitmap (GdkDrawable *drawable,
GdkGC *gc, GdkGC *gc,

View File

@@ -19,6 +19,7 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/log.h" #include "wx/log.h"
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/math.h" // for floating-point functions
#endif #endif
#include "wx/image.h" #include "wx/image.h"
@@ -27,8 +28,6 @@
#include "wx/gtk1/win_gtk.h" #include "wx/gtk1/win_gtk.h"
#include "wx/math.h" // for floating-point functions
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <gdk/gdkprivate.h> #include <gdk/gdkprivate.h>

View File

@@ -16,9 +16,9 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/math.h"
#endif #endif
#include "wx/math.h"
#include "wx/gtk1/private.h" #include "wx/gtk1/private.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -16,9 +16,9 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/math.h"
#endif #endif
#include "wx/math.h"
#include "wx/gtk1/private.h" #include "wx/gtk1/private.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -17,9 +17,9 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/math.h"
#endif #endif
#include "wx/math.h"
#include "wx/gtk1/private.h" #include "wx/gtk1/private.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -18,9 +18,9 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/textctrl.h" // for wxEVT_COMMAND_TEXT_UPDATED #include "wx/textctrl.h" // for wxEVT_COMMAND_TEXT_UPDATED
#include "wx/math.h"
#endif #endif
#include "wx/math.h"
#include "wx/gtk1/private.h" #include "wx/gtk1/private.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -18,16 +18,15 @@
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/panel.h" #include "wx/panel.h"
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/math.h"
#endif #endif
#include "wx/math.h"
#include "wx/strconv.h" #include "wx/strconv.h"
#include "wx/fontutil.h" // for wxNativeFontInfo (GetNativeFontInfo()) #include "wx/fontutil.h" // for wxNativeFontInfo (GetNativeFontInfo())
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <ctype.h> #include <ctype.h>
#include "wx/math.h"
#include "wx/gtk1/private.h" #include "wx/gtk1/private.h"
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
@@ -458,7 +457,7 @@ void wxTextCtrl::WriteText( const wxString &text )
// resetting the style and appending some more text wouldn't work: if // resetting the style and appending some more text wouldn't work: if
// we don't specify the style explicitly, the old style would be used // we don't specify the style explicitly, the old style would be used
gtk_editable_delete_selection( GTK_EDITABLE(m_text) ); gtk_editable_delete_selection( GTK_EDITABLE(m_text) );
wxGtkTextInsert(m_text, m_defaultStyle, text.c_str(), text.Len()); wxGtkTextInsert(m_text, m_defaultStyle, text.c_str(), text.length());
// we called wxGtkTextInsert with correct font, no need to do anything // we called wxGtkTextInsert with correct font, no need to do anything
// in UpdateFontIfNeeded() any longer // in UpdateFontIfNeeded() any longer
@@ -478,7 +477,7 @@ void wxTextCtrl::WriteText( const wxString &text )
// This moves the cursor pos to behind the inserted text. // This moves the cursor pos to behind the inserted text.
gint len = GET_EDITABLE_POS(m_text); gint len = GET_EDITABLE_POS(m_text);
gtk_editable_insert_text( GTK_EDITABLE(m_text), text.c_str(), text.Len(), &len ); gtk_editable_insert_text( GTK_EDITABLE(m_text), text.c_str(), text.length(), &len );
// Bring entry's cursor uptodate. // Bring entry's cursor uptodate.
gtk_entry_set_position( GTK_ENTRY(m_text), len ); gtk_entry_set_position( GTK_ENTRY(m_text), len );
@@ -542,7 +541,7 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
wxString text = GetValue(); wxString text = GetValue();
// cast to prevent warning. But pos really should've been unsigned. // cast to prevent warning. But pos really should've been unsigned.
if( (unsigned long)pos > text.Len() ) if( (unsigned long)pos > text.length() )
return false; return false;
*x=0; // First Col *x=0; // First Col

View File

@@ -31,6 +31,7 @@
#include "wx/combobox.h" #include "wx/combobox.h"
#include "wx/layout.h" #include "wx/layout.h"
#include "wx/statusbr.h" #include "wx/statusbr.h"
#include "wx/math.h"
#endif #endif
#include "wx/module.h" #include "wx/module.h"
@@ -53,7 +54,6 @@
#include "wx/thread.h" #include "wx/thread.h"
#endif #endif
#include "wx/math.h"
#include <ctype.h> #include <ctype.h>
#include "wx/gtk1/private.h" #include "wx/gtk1/private.h"

View File

@@ -22,6 +22,7 @@
#include "wx/timer.h" #include "wx/timer.h"
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/log.h" #include "wx/log.h"
#include "wx/math.h"
#endif #endif
#include "wx/html/forcelnk.h" #include "wx/html/forcelnk.h"
@@ -31,7 +32,6 @@
#include "wx/image.h" #include "wx/image.h"
#include "wx/gifdecod.h" #include "wx/gifdecod.h"
#include "wx/artprov.h" #include "wx/artprov.h"
#include "wx/math.h"
#include <float.h> #include <float.h>

View File

@@ -19,10 +19,10 @@
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/toplevel.h" #include "wx/toplevel.h"
#include "wx/math.h"
#endif #endif
#include "wx/region.h" #include "wx/region.h"
#include "wx/math.h"
#include "wx/mac/private.h" #include "wx/mac/private.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -22,9 +22,9 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/msgdlg.h" #include "wx/msgdlg.h"
#include "wx/math.h"
#endif #endif
#include "wx/math.h"
#include "wx/mac/uma.h" #include "wx/mac/uma.h"
#include "wx/mac/private/print.h" #include "wx/mac/private/print.h"

View File

@@ -1,13 +1,13 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: thread.cpp // Name: src/mac/carbon/mpthread.cpp
// Purpose: wxThread Implementation // Purpose: wxThread Implementation
// Author: Original from Wolfram Gloger/Guilhem Lavaux/Vadim Zeitlin // Author: Original from Wolfram Gloger/Guilhem Lavaux/Vadim Zeitlin
// Modified by: Aj Lavin, Stefan Csomor // Modified by: Aj Lavin, Stefan Csomor
// Created: 04/22/98 // Created: 04/22/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998), // Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998),
// Vadim Zeitlin (1999) , Stefan Csomor (2000) // Vadim Zeitlin (1999) , Stefan Csomor (2000)
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -18,15 +18,15 @@
#include "wx/wxprec.h" #include "wx/wxprec.h"
#if defined(__BORLANDC__) #if defined(__BORLANDC__)
#pragma hdrstop #pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif #endif
#if wxUSE_THREADS #if wxUSE_THREADS
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/module.h" #include "wx/module.h"
#include "wx/thread.h" #include "wx/thread.h"
@@ -36,7 +36,6 @@
#else #else
#include <DriverServices.h> #include <DriverServices.h>
#include <Multiprocessing.h> #include <Multiprocessing.h>
#include "wx/math.h"
#endif #endif
#include "wx/mac/uma.h" #include "wx/mac/uma.h"
#endif #endif
@@ -49,11 +48,11 @@
// this state) // this state)
enum wxThreadState enum wxThreadState
{ {
STATE_NEW, // didn't start execution yet (=> RUNNING) STATE_NEW, // didn't start execution yet (=> RUNNING)
STATE_RUNNING, // thread is running (=> PAUSED, CANCELED) STATE_RUNNING, // thread is running (=> PAUSED, CANCELED)
STATE_PAUSED, // thread is temporarily suspended (=> RUNNING) STATE_PAUSED, // thread is temporarily suspended (=> RUNNING)
STATE_CANCELED, // thread should terminate a.s.a.p. (=> EXITED) STATE_CANCELED, // thread should terminate a.s.a.p. (=> EXITED)
STATE_EXITED // thread is terminating STATE_EXITED // thread is terminating
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -81,7 +80,7 @@ static wxCriticalSection *gs_critsectWaitingForGui = NULL;
// number of threads waiting for GUI in wxMutexGuiEnter() // number of threads waiting for GUI in wxMutexGuiEnter()
static size_t gs_nWaitingForGui = 0; static size_t gs_nWaitingForGui = 0;
// overall number of threads, needed for determining the sleep value of the main // overall number of threads, needed for determining the sleep value of the main
// event loop // event loop
size_t g_numberOfThreads = 0; size_t g_numberOfThreads = 0;
@@ -99,23 +98,23 @@ MPCriticalRegionID gs_guiCritical = kInvalidID;
/* /*
Notes : Notes :
The implementation is very close to the phtreads implementation, the reason for The implementation is very close to the phtreads implementation, the reason for
using MPServices is the fact that these are also available under OS 9. Thus allowing using MPServices is the fact that these are also available under OS 9. Thus allowing
for one common API for all current builds. for one common API for all current builds.
As soon as wxThreads are on a 64 bit address space, the TLS must be extended As soon as wxThreads are on a 64 bit address space, the TLS must be extended
to use two indices one for each 32 bit part as the MP implementation is limited to use two indices one for each 32 bit part as the MP implementation is limited
to longs. to longs.
I have two implementations for mutexes : I have two implementations for mutexes :
version A based on a binary semaphore, problem - not reentrant, version B based version A based on a binary semaphore, problem - not reentrant, version B based
on a critical region, allows for reentrancy, performance implications not on a critical region, allows for reentrancy, performance implications not
yet tested yet tested
The same for condition internal, one implementation by Aj Lavin and the other one The same for condition internal, one implementation by Aj Lavin and the other one
copied from the thrimpl.cpp which I assume has been more broadly tested, I've just copied from the thrimpl.cpp which I assume has been more broadly tested, I've just
replaced the interlock increment with the appropriate PPC calls replaced the interlock increment with the appropriate PPC calls
*/ */
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -124,31 +123,31 @@ MPCriticalRegionID gs_guiCritical = kInvalidID;
static bool wxMacMPThreadsInitVerify() static bool wxMacMPThreadsInitVerify()
{ {
static bool hasThreadManager = false ; static bool hasThreadManager = false ;
if ( !hasThreadManager ) if ( !hasThreadManager )
hasThreadManager = MPLibraryIsLoaded(); hasThreadManager = MPLibraryIsLoaded();
if ( !hasThreadManager )
{
wxMessageBox( wxT("Error") , wxT("MP Thread Support is not available on this System" ), wxOK ) ;
return FALSE ;
}
return TRUE ;
}
#if 0 if ( !hasThreadManager )
{
wxMessageBox( wxT("Error") , wxT("MP Thread Support is not available on this System" ), wxOK ) ;
return false ;
}
return true ;
}
#if 0
class wxMutexInternal class wxMutexInternal
{ {
public: public:
wxMutexInternal(wxMutexType mutexType) ; wxMutexInternal(wxMutexType mutexType) ;
~wxMutexInternal() ; ~wxMutexInternal() ;
bool IsOk() const { return m_isOk; } bool IsOk() const { return m_isOk; }
wxMutexError Lock() ; wxMutexError Lock() ;
wxMutexError TryLock() ; wxMutexError TryLock() ;
wxMutexError Unlock(); wxMutexError Unlock();
private: private:
MPSemaphoreID m_semaphore; MPSemaphoreID m_semaphore;
bool m_isOk ; bool m_isOk ;
}; };
@@ -156,16 +155,16 @@ private:
wxMutexInternal::wxMutexInternal(wxMutexType mutexType ) wxMutexInternal::wxMutexInternal(wxMutexType mutexType )
{ {
wxMacMPThreadsInitVerify() ; wxMacMPThreadsInitVerify() ;
m_isOk = false ; m_isOk = false ;
m_semaphore = kInvalidID ; m_semaphore = kInvalidID ;
OSStatus err = noErr ; OSStatus err = noErr ;
switch( mutexType ) switch( mutexType )
{ {
case wxMUTEX_DEFAULT : case wxMUTEX_DEFAULT :
{ {
verify_noerr( MPCreateBinarySemaphore( & m_semaphore) ); verify_noerr( MPCreateBinarySemaphore( & m_semaphore) );
m_isOk = ( m_semaphore != kInvalidID ) ; m_isOk = ( m_semaphore != kInvalidID ) ;
} }
break ; break ;
@@ -181,37 +180,37 @@ wxMutexInternal::wxMutexInternal(wxMutexType mutexType )
wxMutexInternal::~wxMutexInternal() wxMutexInternal::~wxMutexInternal()
{ {
if ( m_semaphore != kInvalidID ) if ( m_semaphore != kInvalidID )
MPDeleteSemaphore( m_semaphore); MPDeleteSemaphore( m_semaphore);
} }
wxMutexError wxMutexInternal::Lock() wxMutexError wxMutexInternal::Lock()
{ {
wxCHECK_MSG( m_isOk , wxMUTEX_MISC_ERROR , wxT("Invalid Mutex") ) ; wxCHECK_MSG( m_isOk , wxMUTEX_MISC_ERROR , wxT("Invalid Mutex") ) ;
OSStatus err = MPWaitOnSemaphore( m_semaphore, kDurationForever); OSStatus err = MPWaitOnSemaphore( m_semaphore, kDurationForever);
if ( err) if ( err)
{ {
wxLogSysError(wxT("Could not lock mutex")); wxLogSysError(wxT("Could not lock mutex"));
return wxMUTEX_MISC_ERROR; return wxMUTEX_MISC_ERROR;
} }
return wxMUTEX_NO_ERROR; return wxMUTEX_NO_ERROR;
} }
wxMutexError wxMutexInternal::TryLock() wxMutexError wxMutexInternal::TryLock()
{ {
wxCHECK_MSG( m_isOk , wxMUTEX_MISC_ERROR , wxT("Invalid Mutex") ) ; wxCHECK_MSG( m_isOk , wxMUTEX_MISC_ERROR , wxT("Invalid Mutex") ) ;
OSStatus err = MPWaitOnSemaphore( m_semaphore, kDurationImmediate); OSStatus err = MPWaitOnSemaphore( m_semaphore, kDurationImmediate);
if ( err) if ( err)
{ {
if ( err == kMPTimeoutErr) if ( err == kMPTimeoutErr)
{ {
return wxMUTEX_BUSY; return wxMUTEX_BUSY;
} }
wxLogSysError(wxT("Could not try lock mutex")); wxLogSysError(wxT("Could not try lock mutex"));
return wxMUTEX_MISC_ERROR; return wxMUTEX_MISC_ERROR;
} }
return wxMUTEX_NO_ERROR; return wxMUTEX_NO_ERROR;
} }
wxMutexError wxMutexInternal::Unlock() wxMutexError wxMutexInternal::Unlock()
@@ -221,10 +220,10 @@ wxMutexError wxMutexInternal::Unlock()
if ( err) if ( err)
{ {
wxLogSysError(_("Could not unlock mutex")); wxLogSysError(_("Could not unlock mutex"));
return wxMUTEX_MISC_ERROR; return wxMUTEX_MISC_ERROR;
} }
return wxMUTEX_NO_ERROR; return wxMUTEX_NO_ERROR;
} }
#else #else
@@ -235,11 +234,11 @@ public:
wxMutexInternal(wxMutexType mutexType) ; wxMutexInternal(wxMutexType mutexType) ;
~wxMutexInternal() ; ~wxMutexInternal() ;
bool IsOk() const { return m_isOk; } bool IsOk() const { return m_isOk; }
wxMutexError Lock() ; wxMutexError Lock() ;
wxMutexError TryLock() ; wxMutexError TryLock() ;
wxMutexError Unlock(); wxMutexError Unlock();
private: private:
MPCriticalRegionID m_critRegion ; MPCriticalRegionID m_critRegion ;
bool m_isOk ; bool m_isOk ;
}; };
@@ -249,10 +248,10 @@ wxMutexInternal::wxMutexInternal(wxMutexType mutexType )
wxMacMPThreadsInitVerify() ; wxMacMPThreadsInitVerify() ;
m_isOk = false ; m_isOk = false ;
m_critRegion = kInvalidID ; m_critRegion = kInvalidID ;
verify_noerr( MPCreateCriticalRegion( & m_critRegion) ); verify_noerr( MPCreateCriticalRegion( & m_critRegion) );
m_isOk = ( m_critRegion != kInvalidID ) ; m_isOk = ( m_critRegion != kInvalidID ) ;
if ( !IsOk() ) if ( !IsOk() )
wxFAIL_MSG(wxT("Error when creating mutex") ) ; wxFAIL_MSG(wxT("Error when creating mutex") ) ;
} }
@@ -272,8 +271,8 @@ wxMutexError wxMutexInternal::Lock()
wxLogSysError(wxT("Could not lock mutex")); wxLogSysError(wxT("Could not lock mutex"));
return wxMUTEX_MISC_ERROR; return wxMUTEX_MISC_ERROR;
} }
return wxMUTEX_NO_ERROR; return wxMUTEX_NO_ERROR;
} }
wxMutexError wxMutexInternal::TryLock() wxMutexError wxMutexInternal::TryLock()
@@ -287,10 +286,10 @@ wxMutexError wxMutexInternal::TryLock()
return wxMUTEX_BUSY; return wxMUTEX_BUSY;
} }
wxLogSysError(wxT("Could not try lock mutex")); wxLogSysError(wxT("Could not try lock mutex"));
return wxMUTEX_MISC_ERROR; return wxMUTEX_MISC_ERROR;
} }
return wxMUTEX_NO_ERROR; return wxMUTEX_NO_ERROR;
} }
wxMutexError wxMutexInternal::Unlock() wxMutexError wxMutexInternal::Unlock()
@@ -300,10 +299,10 @@ wxMutexError wxMutexInternal::Unlock()
if ( err) if ( err)
{ {
wxLogSysError(_("Could not unlock mutex")); wxLogSysError(_("Could not unlock mutex"));
return wxMUTEX_MISC_ERROR; return wxMUTEX_MISC_ERROR;
} }
return wxMUTEX_NO_ERROR; return wxMUTEX_NO_ERROR;
} }
#endif #endif
@@ -317,22 +316,22 @@ class wxSemaphoreInternal
public: public:
wxSemaphoreInternal(int initialcount, int maxcount); wxSemaphoreInternal(int initialcount, int maxcount);
~wxSemaphoreInternal(); ~wxSemaphoreInternal();
bool IsOk() const { return m_isOk; } bool IsOk() const { return m_isOk; }
wxSemaError WaitTimeout(unsigned long milliseconds); wxSemaError WaitTimeout(unsigned long milliseconds);
wxSemaError Wait() { return WaitTimeout( kDurationForever); } wxSemaError Wait() { return WaitTimeout( kDurationForever); }
wxSemaError TryWait() wxSemaError TryWait()
{ {
wxSemaError err = WaitTimeout(kDurationImmediate); wxSemaError err = WaitTimeout(kDurationImmediate);
if ( err == wxSEMA_TIMEOUT ) if ( err == wxSEMA_TIMEOUT )
err = wxSEMA_BUSY ; err = wxSEMA_BUSY ;
return err ; return err ;
} }
wxSemaError Post(); wxSemaError Post();
private: private:
MPSemaphoreID m_semaphore; MPSemaphoreID m_semaphore;
bool m_isOk ; bool m_isOk ;
@@ -350,7 +349,7 @@ wxSemaphoreInternal::wxSemaphoreInternal(int initialcount, int maxcount)
} }
verify_noerr( MPCreateSemaphore( maxcount, initialcount, & m_semaphore) ); verify_noerr( MPCreateSemaphore( maxcount, initialcount, & m_semaphore) );
m_isOk = ( m_semaphore != kInvalidID ) ; m_isOk = ( m_semaphore != kInvalidID ) ;
if ( !IsOk() ) if ( !IsOk() )
wxFAIL_MSG(wxT("Error when creating semaphore") ) ; wxFAIL_MSG(wxT("Error when creating semaphore") ) ;
} }
@@ -394,8 +393,8 @@ wxSemaError wxSemaphoreInternal::Post()
class wxConditionInternal class wxConditionInternal
{ {
public: public:
wxConditionInternal(wxMutex& mutex) wxConditionInternal(wxMutex& mutex)
: m_mutex( mutex), : m_mutex( mutex),
m_semaphore( 0, 1), m_semaphore( 0, 1),
m_gate( 1, 1) m_gate( 1, 1)
@@ -404,34 +403,34 @@ public:
m_signals = 0; m_signals = 0;
m_canceled = 0; m_canceled = 0;
} }
~wxConditionInternal() ~wxConditionInternal()
{ {
} }
bool IsOk() const { return m_mutex.IsOk() ; } bool IsOk() const { return m_mutex.IsOk() ; }
wxCondError Wait() wxCondError Wait()
{ {
return WaitTimeout( kDurationForever); return WaitTimeout( kDurationForever);
} }
wxCondError WaitTimeout(unsigned long msectimeout); wxCondError WaitTimeout(unsigned long msectimeout);
wxCondError Signal() wxCondError Signal()
{ {
return DoSignal( false); return DoSignal( false);
} }
wxCondError Broadcast() wxCondError Broadcast()
{ {
return DoSignal( true); return DoSignal( true);
} }
private: private:
wxCondError DoSignal( bool signalAll); wxCondError DoSignal( bool signalAll);
wxMutex& m_mutex; wxMutex& m_mutex;
wxSemaphoreInternal m_semaphore; // Signals the waiting threads. wxSemaphoreInternal m_semaphore; // Signals the waiting threads.
wxSemaphoreInternal m_gate; wxSemaphoreInternal m_gate;
@@ -443,7 +442,7 @@ private:
wxCondError wxConditionInternal::WaitTimeout(unsigned long msectimeout) wxCondError wxConditionInternal::WaitTimeout(unsigned long msectimeout)
{ {
m_gate.Wait(); m_gate.Wait();
if ( ++ m_waiters == INT_MAX) if ( ++ m_waiters == INT_MAX)
{ {
@@ -454,24 +453,24 @@ wxCondError wxConditionInternal::WaitTimeout(unsigned long msectimeout)
m_varSection.Leave(); m_varSection.Leave();
} }
m_gate.Post(); m_gate.Post();
m_mutex.Unlock(); m_mutex.Unlock();
wxSemaError err = m_semaphore.WaitTimeout( msectimeout); wxSemaError err = m_semaphore.WaitTimeout( msectimeout);
wxASSERT( err == wxSEMA_NO_ERROR || err == wxSEMA_TIMEOUT); wxASSERT( err == wxSEMA_NO_ERROR || err == wxSEMA_TIMEOUT);
m_varSection.Enter(); m_varSection.Enter();
if ( err != wxSEMA_NO_ERROR) if ( err != wxSEMA_NO_ERROR)
{ {
if ( m_signals > m_canceled) if ( m_signals > m_canceled)
{ {
// A signal is being sent after we timed out. // A signal is being sent after we timed out.
if ( m_waiters == m_signals) if ( m_waiters == m_signals)
{ {
// There are no excess waiters to catch the signal, so // There are no excess waiters to catch the signal, so
// we must throw it away. // we must throw it away.
wxSemaError err2 = m_semaphore.Wait(); wxSemaError err2 = m_semaphore.Wait();
if ( err2 != wxSEMA_NO_ERROR) if ( err2 != wxSEMA_NO_ERROR)
{ {
@@ -514,15 +513,15 @@ wxCondError wxConditionInternal::WaitTimeout(unsigned long msectimeout)
} }
} }
m_varSection.Leave(); m_varSection.Leave();
m_mutex.Lock(); m_mutex.Lock();
if ( err) if ( err)
{ {
return err == wxSEMA_TIMEOUT ? wxCOND_TIMEOUT : wxCOND_MISC_ERROR; return err == wxSEMA_TIMEOUT ? wxCOND_TIMEOUT : wxCOND_MISC_ERROR;
} }
return wxCOND_NO_ERROR; return wxCOND_NO_ERROR;
} }
@@ -530,36 +529,36 @@ wxCondError wxConditionInternal::DoSignal( bool signalAll)
{ {
m_gate.Wait(); m_gate.Wait();
m_varSection.Enter(); m_varSection.Enter();
wxASSERT( m_signals == m_canceled); wxASSERT( m_signals == m_canceled);
if ( m_waiters == m_canceled) if ( m_waiters == m_canceled)
{ {
m_varSection.Leave(); m_varSection.Leave();
m_gate.Post(); m_gate.Post();
return wxCOND_NO_ERROR; return wxCOND_NO_ERROR;
} }
if ( m_canceled > 0) if ( m_canceled > 0)
{ {
m_waiters -= m_canceled; m_waiters -= m_canceled;
m_signals = 0; m_signals = 0;
m_canceled = 0; m_canceled = 0;
} }
m_signals = signalAll ? m_waiters : 1; m_signals = signalAll ? m_waiters : 1;
size_t n = m_signals; size_t n = m_signals;
m_varSection.Leave(); m_varSection.Leave();
// Let the waiters inherit the gate lock. // Let the waiters inherit the gate lock.
do do
{ {
wxSemaError err = m_semaphore.Post(); wxSemaError err = m_semaphore.Post();
wxASSERT( err == wxSEMA_NO_ERROR); wxASSERT( err == wxSEMA_NO_ERROR);
} while ( -- n); } while ( -- n);
return wxCOND_NO_ERROR; return wxCOND_NO_ERROR;
} }
@@ -718,14 +717,14 @@ public:
m_prio = WXTHREAD_DEFAULT_PRIORITY; m_prio = WXTHREAD_DEFAULT_PRIORITY;
m_notifyQueueId = kInvalidID; m_notifyQueueId = kInvalidID;
m_exitcode = 0; m_exitcode = 0;
m_cancelled = FALSE ; m_cancelled = false ;
// set to TRUE only when the thread starts waiting on m_semSuspend // set to true only when the thread starts waiting on m_semSuspend
m_isPaused = FALSE; m_isPaused = false;
// defaults for joinable threads // defaults for joinable threads
m_shouldBeJoined = TRUE; m_shouldBeJoined = true;
m_isDetached = FALSE; m_isDetached = false;
} }
~wxThreadInternal() ~wxThreadInternal()
{ {
@@ -765,7 +764,7 @@ public:
// Get the ID of this thread's underlying MP Services task. // Get the ID of this thread's underlying MP Services task.
MPTaskID GetId() const { return m_tid; } MPTaskID GetId() const { return m_tid; }
void SetCancelFlag() { m_cancelled = TRUE; } void SetCancelFlag() { m_cancelled = true; }
bool WasCancelled() const { return m_cancelled; } bool WasCancelled() const { return m_cancelled; }
// exit code // exit code
void SetExitCode(wxThread::ExitCode exitcode) { m_exitcode = exitcode; } void SetExitCode(wxThread::ExitCode exitcode) { m_exitcode = exitcode; }
@@ -780,8 +779,8 @@ public:
{ {
wxCriticalSectionLocker lock(m_csJoinFlag); wxCriticalSectionLocker lock(m_csJoinFlag);
m_shouldBeJoined = FALSE; m_shouldBeJoined = false;
m_isDetached = TRUE; m_isDetached = true;
} }
private: private:
@@ -852,7 +851,7 @@ OSStatus wxThreadInternal::MacThreadStart(void *parameter)
pthread->SetState(STATE_EXITED); pthread->SetState(STATE_EXITED);
} }
} }
if ( dontRunAtAll ) if ( dontRunAtAll )
{ {
if ( pthread->m_isDetached ) if ( pthread->m_isDetached )
@@ -880,7 +879,7 @@ bool wxThreadInternal::Create(wxThread *thread, unsigned int stackSize)
OSStatus err = noErr ; OSStatus err = noErr ;
m_thread = thread; m_thread = thread;
if ( m_notifyQueueId == kInvalidID ) if ( m_notifyQueueId == kInvalidID )
{ {
OSStatus err = MPCreateQueue( & m_notifyQueueId); OSStatus err = MPCreateQueue( & m_notifyQueueId);
@@ -890,9 +889,9 @@ bool wxThreadInternal::Create(wxThread *thread, unsigned int stackSize)
return false; return false;
} }
} }
m_state = STATE_NEW; m_state = STATE_NEW;
err = MPCreateTask( MacThreadStart, err = MPCreateTask( MacThreadStart,
(void*) m_thread, (void*) m_thread,
stackSize, stackSize,
@@ -901,25 +900,25 @@ bool wxThreadInternal::Create(wxThread *thread, unsigned int stackSize)
0, 0,
0, 0,
&m_tid); &m_tid);
if ( err) if ( err)
{ {
wxLogSysError(_("Can't create thread")); wxLogSysError(_("Can't create thread"));
return false; return false;
} }
if ( m_prio != WXTHREAD_DEFAULT_PRIORITY ) if ( m_prio != WXTHREAD_DEFAULT_PRIORITY )
{ {
SetPriority(m_prio); SetPriority(m_prio);
} }
return true; return true;
} }
void wxThreadInternal::SetPriority( int priority) void wxThreadInternal::SetPriority( int priority)
{ {
m_prio = priority; m_prio = priority;
if ( m_tid) if ( m_tid)
{ {
// Mac priorities range from 1 to 10,000, with a default of 100. // Mac priorities range from 1 to 10,000, with a default of 100.
@@ -927,7 +926,7 @@ void wxThreadInternal::SetPriority( int priority)
// We can map wxWidgets to Mac priorities easily by assuming // We can map wxWidgets to Mac priorities easily by assuming
// the former uses a logarithmic scale. // the former uses a logarithmic scale.
const unsigned int macPriority = ( int)( exp( priority / 25.0 * log( 10.0)) + 0.5); const unsigned int macPriority = ( int)( exp( priority / 25.0 * log( 10.0)) + 0.5);
MPSetTaskWeight( m_tid, macPriority); MPSetTaskWeight( m_tid, macPriority);
} }
} }
@@ -963,10 +962,10 @@ void wxThreadInternal::Wait()
void * param2; void * param2;
void * rc; void * rc;
OSStatus err = MPWaitOnQueue ( m_notifyQueueId, OSStatus err = MPWaitOnQueue ( m_notifyQueueId,
& param1, & param1,
& param2, & param2,
& rc, & rc,
kDurationForever); kDurationForever);
if ( err) if ( err)
{ {
@@ -978,7 +977,7 @@ void wxThreadInternal::Wait()
// but we don't need this here // but we don't need this here
m_exitcode = rc; m_exitcode = rc;
m_shouldBeJoined = FALSE; m_shouldBeJoined = false;
} }
} }
@@ -1073,7 +1072,7 @@ wxThread::wxThread(wxThreadKind kind)
{ {
g_numberOfThreads++; g_numberOfThreads++;
m_internal = new wxThreadInternal(); m_internal = new wxThreadInternal();
m_isDetached = (kind == wxTHREAD_DETACHED); m_isDetached = (kind == wxTHREAD_DETACHED);
} }
@@ -1102,7 +1101,7 @@ wxThread::~wxThread()
wxThreadError wxThread::Create(unsigned int stackSize) wxThreadError wxThread::Create(unsigned int stackSize)
{ {
wxCriticalSectionLocker lock(m_critsect); wxCriticalSectionLocker lock(m_critsect);
if ( m_isDetached ) if ( m_isDetached )
{ {
m_internal->Detach() ; m_internal->Detach() ;
@@ -1112,7 +1111,7 @@ wxThreadError wxThread::Create(unsigned int stackSize)
m_internal->SetState(STATE_EXITED); m_internal->SetState(STATE_EXITED);
return wxTHREAD_NO_RESOURCE; return wxTHREAD_NO_RESOURCE;
} }
return wxTHREAD_NO_ERROR; return wxTHREAD_NO_ERROR;
} }
@@ -1297,7 +1296,7 @@ void wxThread::Exit(ExitCode status)
OnExit(); OnExit();
MPTerminateTask( m_internal->GetId() , (long) status) ; MPTerminateTask( m_internal->GetId() , (long) status) ;
if ( IsDetached() ) if ( IsDetached() )
{ {
delete this; delete this;
@@ -1398,10 +1397,10 @@ bool wxThread::IsAlive() const
{ {
case STATE_RUNNING: case STATE_RUNNING:
case STATE_PAUSED: case STATE_PAUSED:
return TRUE; return true;
default: default:
return FALSE; return false;
} }
} }
@@ -1421,7 +1420,7 @@ class wxThreadModule : public wxModule
public: public:
virtual bool OnInit(); virtual bool OnInit();
virtual void OnExit(); virtual void OnExit();
private: private:
DECLARE_DYNAMIC_CLASS(wxThreadModule) DECLARE_DYNAMIC_CLASS(wxThreadModule)
}; };
@@ -1429,24 +1428,24 @@ private:
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule) IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
bool wxThreadModule::OnInit() bool wxThreadModule::OnInit()
{ {
if ( !wxMacMPThreadsInitVerify() ) if ( !wxMacMPThreadsInitVerify() )
{ {
return FALSE ; return false ;
} }
verify_noerr( MPAllocateTaskStorageIndex( &gs_tlsForWXThread ) ) ; verify_noerr( MPAllocateTaskStorageIndex( &gs_tlsForWXThread ) ) ;
// main thread's This() is NULL // main thread's This() is NULL
verify_noerr( MPSetTaskStorageValue( gs_tlsForWXThread , NULL ) ) ; verify_noerr( MPSetTaskStorageValue( gs_tlsForWXThread , NULL ) ) ;
gs_idMainThread = wxThread::GetCurrentId() ; gs_idMainThread = wxThread::GetCurrentId() ;
gs_critsectWaitingForGui = new wxCriticalSection(); gs_critsectWaitingForGui = new wxCriticalSection();
gs_critsectGui = new wxCriticalSection(); gs_critsectGui = new wxCriticalSection();
gs_critsectGui->Enter(); gs_critsectGui->Enter();
return TRUE; return true;
} }
void wxThreadModule::OnExit() void wxThreadModule::OnExit()

View File

@@ -24,9 +24,9 @@
#include "wx/app.h" #include "wx/app.h"
#include "wx/msgdlg.h" #include "wx/msgdlg.h"
#include "wx/dcprint.h" #include "wx/dcprint.h"
#include "wx/math.h"
#endif #endif
#include "wx/math.h"
#include "wx/mac/uma.h" #include "wx/mac/uma.h"
#include "wx/mac/printmac.h" #include "wx/mac/printmac.h"

View File

@@ -1,23 +1,23 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: src/mac/carbon/thread.cpp // Name: src/mac/carbon/thread.cpp
// Purpose: wxThread Implementation // Purpose: wxThread Implementation
// Author: Original from Wolfram Gloger/Guilhem Lavaux/Vadim Zeitlin // Author: Original from Wolfram Gloger/Guilhem Lavaux/Vadim Zeitlin
// Modified by: Aj Lavin, Stefan Csomor // Modified by: Aj Lavin, Stefan Csomor
// Created: 04/22/98 // Created: 04/22/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998), // Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998),
// Vadim Zeitlin (1999), Stefan Csomor (2000) // Vadim Zeitlin (1999), Stefan Csomor (2000)
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h" #include "wx/wxprec.h"
#if defined(__BORLANDC__) #if defined(__BORLANDC__)
#pragma hdrstop #pragma hdrstop
#endif #endif
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/wx.h" #include "wx/wx.h"
#endif #endif
#if wxUSE_THREADS #if wxUSE_THREADS
@@ -31,7 +31,6 @@
#else #else
#include <DriverServices.h> #include <DriverServices.h>
#include <Multiprocessing.h> #include <Multiprocessing.h>
#include "wx/math.h"
#endif #endif
#include "wx/mac/uma.h" #include "wx/mac/uma.h"

View File

@@ -17,10 +17,10 @@
#include "wx/window.h" #include "wx/window.h"
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/toplevel.h" #include "wx/toplevel.h"
#include "wx/math.h"
#endif #endif
#include "wx/region.h" #include "wx/region.h"
#include "wx/math.h"
#include "wx/mac/private.h" #include "wx/mac/private.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -20,9 +20,9 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/msgdlg.h" #include "wx/msgdlg.h"
#include "wx/math.h"
#endif #endif
#include "wx/math.h"
#include "wx/mac/uma.h" #include "wx/mac/uma.h"
#include "wx/mac/private/print.h" #include "wx/mac/private/print.h"

View File

@@ -19,6 +19,10 @@
#include "wx/motif/bmpmotif.h" #include "wx/motif/bmpmotif.h"
#ifndef WX_PRECOMP
#include "wx/math.h"
#endif
#ifdef __VMS__ #ifdef __VMS__
#pragma message disable nosimpint #pragma message disable nosimpint
#endif #endif
@@ -33,8 +37,6 @@
#include <X11/xpm.h> #include <X11/xpm.h>
#endif #endif
#include "wx/math.h"
Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap ); Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap );
static inline wxCharBuffer GetCacheImageName(WXImage image) static inline wxCharBuffer GetCacheImageName(WXImage image)

View File

@@ -46,10 +46,10 @@
#include "wx/app.h" #include "wx/app.h"
#include "wx/window.h" #include "wx/window.h"
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/math.h"
#endif #endif
#include "wx/image.h" #include "wx/image.h"
#include "wx/math.h"
#ifdef __VMS__ #ifdef __VMS__
#pragma message disable nosimpint #pragma message disable nosimpint

View File

@@ -35,10 +35,10 @@
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/dialog.h" #include "wx/dialog.h"
#include "wx/cmndata.h" #include "wx/cmndata.h"
#include "wx/math.h"
#endif #endif
#include "wx/msw/private.h" #include "wx/msw/private.h"
#include "wx/math.h"
#include "wx/msw/wrapcdlg.h" #include "wx/msw/wrapcdlg.h"
#include <stdlib.h> #include <stdlib.h>

View File

@@ -33,6 +33,7 @@
#include "wx/log.h" #include "wx/log.h"
#include "wx/window.h" #include "wx/window.h"
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/math.h"
#endif #endif
#include "wx/msw/private.h" #include "wx/msw/private.h"
@@ -43,7 +44,6 @@
#include "wx/printdlg.h" #include "wx/printdlg.h"
#include "wx/msw/printdlg.h" #include "wx/msw/printdlg.h"
#include "wx/math.h"
#include "wx/msw/wrapcdlg.h" #include "wx/msw/wrapcdlg.h"
#ifndef __WIN32__ #ifndef __WIN32__

View File

@@ -35,6 +35,7 @@
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/log.h" #include "wx/log.h"
#include "wx/app.h" #include "wx/app.h"
#include "wx/math.h"
#endif #endif
#include "wx/msw/wrapcdlg.h" #include "wx/msw/wrapcdlg.h"
@@ -44,7 +45,6 @@
#include "wx/filename.h" #include "wx/filename.h"
#include "wx/tokenzr.h" #include "wx/tokenzr.h"
#include "wx/math.h"
#include "wx/msw/missing.h" #include "wx/msw/missing.h"

View File

@@ -33,12 +33,11 @@
#include "wx/dialog.h" #include "wx/dialog.h"
#include "wx/log.h" #include "wx/log.h"
#include "wx/cmndata.h" #include "wx/cmndata.h"
#include "wx/math.h"
#endif #endif
#include "wx/msw/wrapcdlg.h" #include "wx/msw/wrapcdlg.h"
#include "wx/math.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@@ -38,9 +38,9 @@
#include "wx/log.h" #include "wx/log.h"
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/timer.h" #include "wx/timer.h"
#include "wx/math.h" // log10 & pow
#endif #endif
#include "wx/math.h" // log10 & pow
#include "wx/msw/private.h" // user info and wndproc setting/getting #include "wx/msw/private.h" // user info and wndproc setting/getting
#include "wx/dynlib.h" #include "wx/dynlib.h"

View File

@@ -64,9 +64,9 @@
#include "wx/log.h" #include "wx/log.h"
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/timer.h" #include "wx/timer.h"
#include "wx/math.h" // log10 & pow
#endif #endif
#include "wx/math.h" // log10 & pow
#include "wx/msw/private.h" // user info and wndproc setting/getting #include "wx/msw/private.h" // user info and wndproc setting/getting
#include "wx/dynlib.h" #include "wx/dynlib.h"
#include "wx/stopwatch.h" #include "wx/stopwatch.h"

View File

@@ -25,10 +25,9 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/math.h"
#endif #endif
#include "wx/math.h"
// I don't know why members of tagVARIANT aren't found when compiling // I don't know why members of tagVARIANT aren't found when compiling
// with Wine // with Wine
#ifndef __WINE__ #ifndef __WINE__

View File

@@ -22,13 +22,13 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/log.h" #include "wx/log.h"
#include "wx/math.h"
#endif #endif
#define _FORCENAMELESSUNION #define _FORCENAMELESSUNION
#include "wx/msw/private.h" #include "wx/msw/private.h"
#include "wx/msw/ole/oleutils.h" #include "wx/msw/ole/oleutils.h"
#include "wx/msw/ole/automtn.h" #include "wx/msw/ole/automtn.h"
#include "wx/math.h"
#ifdef __WXWINCE__ #ifdef __WXWINCE__
#include "wx/msw/wince/time.h" #include "wx/msw/wince/time.h"

View File

@@ -19,6 +19,7 @@
#include "wx/app.h" #include "wx/app.h"
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/icon.h" #include "wx/icon.h"
#include "wx/math.h"
#endif #endif
#include "wx/image.h" #include "wx/image.h"
@@ -42,7 +43,6 @@ bool wxGetImageFromDrawable(GR_DRAW_ID drawable, int srcX, int srcY, int width,
#include "wx/wfstream.h" #include "wx/wfstream.h"
#endif #endif
#endif #endif
#include "wx/math.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxMask // wxMask

View File

@@ -18,6 +18,7 @@
#include "wx/app.h" #include "wx/app.h"
#include "wx/window.h" #include "wx/window.h"
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/math.h"
#endif #endif
#include "wx/image.h" #include "wx/image.h"
@@ -26,8 +27,6 @@
#include "wx/x11/private.h" #include "wx/x11/private.h"
#include "wx/math.h"
#if wxUSE_UNICODE #if wxUSE_UNICODE
#include "glib.h" #include "glib.h"
#include "pango/pangox.h" #include "pango/pangox.h"
@@ -1594,7 +1593,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
#endif #endif
{ {
XDrawString( (Display*) m_display, (Window) m_window, XDrawString( (Display*) m_display, (Window) m_window,
(GC) m_textGC, x, y + XFontStructGetAscent(xfont), text.c_str(), text.Len() ); (GC) m_textGC, x, y + XFontStructGetAscent(xfont), text.c_str(), text.length() );
} }
#if 0 #if 0
@@ -1670,7 +1669,7 @@ void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoor
int direction, ascent, descent2; int direction, ascent, descent2;
XCharStruct overall; XCharStruct overall;
XTextExtents( xfont, (char*) string.c_str(), string.Len(), &direction, XTextExtents( xfont, (char*) string.c_str(), string.length(), &direction,
&ascent, &descent2, &overall); &ascent, &descent2, &overall);
if (width) if (width)