+// ----------------------------------------------------------------------------
+// sleep functions
+// ----------------------------------------------------------------------------
+
+#if wxUSE_GUI
+
+// Sleep for nSecs seconds. Attempt a Windows implementation using timers.
+static bool gs_inTimer = FALSE;
+
+class wxSleepTimer: public wxTimer
+{
+public:
+ virtual void Notify()
+ {
+ gs_inTimer = FALSE;
+ Stop();
+ }
+};
+
+static wxTimer *wxTheSleepTimer = NULL;
+
+void wxUsleep(unsigned long milliseconds)
+{
+#ifdef __WIN32__
+ ::Sleep(milliseconds);
+#else
+ if (gs_inTimer)
+ return;
+
+ wxTheSleepTimer = new wxSleepTimer;
+ gs_inTimer = TRUE;
+ wxTheSleepTimer->Start(milliseconds);
+ while (gs_inTimer)
+ {
+ if (wxTheApp->Pending())
+ wxTheApp->Dispatch();
+ }
+ delete wxTheSleepTimer;
+ wxTheSleepTimer = NULL;
+#endif
+}
+
+void wxSleep(int nSecs)
+{
+ if (gs_inTimer)
+ return;
+
+ wxTheSleepTimer = new wxSleepTimer;
+ gs_inTimer = TRUE;
+ wxTheSleepTimer->Start(nSecs*1000);
+ while (gs_inTimer)
+ {
+ if (wxTheApp->Pending())
+ wxTheApp->Dispatch();
+ }
+ delete wxTheSleepTimer;
+ wxTheSleepTimer = NULL;
+}
+
+// Consume all events until no more left
+void wxFlushEvents()
+{
+// wxYield();
+}
+
+#elif defined(__WIN32__) // wxUSE_GUI
+
+void wxUsleep(unsigned long milliseconds)
+{
+ ::Sleep(milliseconds);
+}
+
+void wxSleep(int nSecs)
+{
+ wxUsleep(1000*nSecs);
+}
+
+#endif // wxUSE_GUI/!wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// deprecated (in favour of wxLog) log functions
+// ----------------------------------------------------------------------------
+
+#if wxUSE_GUI
+
+// Output a debug mess., in a system dependent fashion.
+void wxDebugMsg(const wxChar *fmt ...)
+{
+ va_list ap;
+ static wxChar buffer[512];
+
+ if (!wxTheApp->GetWantDebugOutput())
+ return ;
+
+ va_start(ap, fmt);
+
+ wvsprintf(buffer,fmt,ap) ;
+ OutputDebugString((LPCTSTR)buffer) ;
+
+ va_end(ap);
+}
+
+// Non-fatal error: pop up message box and (possibly) continue
+void wxError(const wxString& msg, const wxString& title)
+{
+ wxSprintf(wxBuffer, wxT("%s\nContinue?"), WXSTRINGCAST msg);
+ if (MessageBox(NULL, (LPCTSTR)wxBuffer, (LPCTSTR)WXSTRINGCAST title,
+ MB_ICONSTOP | MB_YESNO) == IDNO)
+ wxExit();
+}
+
+// Fatal error: pop up message box and abort
+void wxFatalError(const wxString& msg, const wxString& title)
+{
+ wxSprintf(wxBuffer, wxT("%s: %s"), WXSTRINGCAST title, WXSTRINGCAST msg);
+ FatalAppExit(0, (LPCTSTR)wxBuffer);
+}
+
+// ----------------------------------------------------------------------------
+// functions to work with .INI files
+// ----------------------------------------------------------------------------
+