From 7e1e6965118640381e57adc373e4817db470e927 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Thu, 21 Jul 2005 17:18:43 +0000 Subject: [PATCH] wxOS2 with Open Watcom: correct PCH usage, missing headers, warning fixes, source cleaning and other Watcom adjustements. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34903 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/os2/app.h | 4 +-- include/wx/os2/bitmap.h | 19 +++++------- include/wx/os2/listbox.h | 8 ++--- include/wx/os2/menu.h | 6 ++-- include/wx/os2/mimetype.h | 13 ++++---- include/wx/os2/private.h | 56 ++++++++++++++++++++++++++-------- include/wx/os2/spinctrl.h | 26 ++++++++-------- include/wx/os2/tooltip.h | 5 ++- src/unix/gsocket.cpp | 64 ++++++++++++++++++++++----------------- 9 files changed, 118 insertions(+), 83 deletions(-) diff --git a/include/wx/os2/app.h b/include/wx/os2/app.h index 37fcdf23d6..c97e1d4e93 100644 --- a/include/wx/os2/app.h +++ b/include/wx/os2/app.h @@ -14,6 +14,7 @@ #ifdef __WATCOMC__ +#include #include #include @@ -74,7 +75,7 @@ public: virtual bool OnInitGui(void); - virtual bool Yield(bool onlyIfNeeded = FALSE); + virtual bool Yield(bool onlyIfNeeded = false); virtual void WakeUpIdle(void); virtual void SetPrintMode(int mode) { m_nPrintMode = mode; } @@ -120,4 +121,3 @@ protected: }; #endif // _WX_APP_H_ - diff --git a/include/wx/os2/bitmap.h b/include/wx/os2/bitmap.h index ca736176ea..555184acc8 100644 --- a/include/wx/os2/bitmap.h +++ b/include/wx/os2/bitmap.h @@ -106,10 +106,7 @@ public: ); // If depth is omitted, will create a bitmap compatible with the display - wxBitmap( int nWidth - ,int nHeight - ,int nDepth = -1 - ); + wxBitmap( int nWidth, int nHeight, int nDepth = -1 ); wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); } @@ -339,14 +336,14 @@ public: ,int lType ); private: - inline virtual bool Load( wxGDIImage* pImage - ,const wxString& rName - ,HPS hPs - ,long lFlags - ,int nDesiredWidth - ,int nDesiredHeight + inline virtual bool Load( wxGDIImage* WXUNUSED(pImage) + ,const wxString& WXUNUSED(rName) + ,HPS WXUNUSED(hPs) + ,long WXUNUSED(lFlags) + ,int WXUNUSED(nDesiredWidth) + ,int WXUNUSED(nDesiredHeight) ) - { return FALSE; } + { return false; } DECLARE_DYNAMIC_CLASS(wxBitmapHandler) }; // end of CLASS wxBitmapHandler diff --git a/include/wx/os2/listbox.h b/include/wx/os2/listbox.h index f0bd7cf3e3..0a09107a16 100644 --- a/include/wx/os2/listbox.h +++ b/include/wx/os2/listbox.h @@ -17,12 +17,12 @@ // ---------------------------------------------------------------------------- #if wxUSE_OWNER_DRAWN - class WXDLLEXPORT wxOwnerDrawn; + class WXDLLEXPORT wxOwnerDrawn; - // define the array of list box items - #include + // define the array of list box items + #include - WX_DEFINE_EXPORTED_ARRAY(wxOwnerDrawn *, wxListBoxItemsArray); + WX_DEFINE_EXPORTED_ARRAY_PTR(wxOwnerDrawn *, wxListBoxItemsArray); #endif // wxUSE_OWNER_DRAWN // forward decl for GetSelections() diff --git a/include/wx/os2/menu.h b/include/wx/os2/menu.h index 35c3b9016c..b871f900e4 100644 --- a/include/wx/os2/menu.h +++ b/include/wx/os2/menu.h @@ -17,7 +17,7 @@ #include "wx/list.h" // for "template" list classes #include "wx/dynarray.h" - WX_DEFINE_EXPORTED_ARRAY(wxAcceleratorEntry *, wxAcceleratorArray); + WX_DEFINE_EXPORTED_ARRAY_PTR(wxAcceleratorEntry *, wxAcceleratorArray); #endif // wxUSE_ACCEL class WXDLLEXPORT wxFrame; @@ -139,9 +139,9 @@ private: void EndRadioGroup(void); // - // If TRUE, insert a breal before appending the next item + // If true, insert a breal before appending the next item // - bool m_bDoBreak; + bool m_bDoBreak; // // The menu handle of this menu diff --git a/include/wx/os2/mimetype.h b/include/wx/os2/mimetype.h index 475fb05288..f21ddc37fb 100644 --- a/include/wx/os2/mimetype.h +++ b/include/wx/os2/mimetype.h @@ -63,10 +63,10 @@ public: bool Unassociate(); // set an arbitrary command, ask confirmation if it already exists and - // overwriteprompt is TRUE + // overwriteprompt is true bool SetCommand(const wxString& cmd, const wxString& verb, - bool overwriteprompt = TRUE); + bool overwriteprompt = true); bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0); @@ -101,10 +101,10 @@ public: size_t EnumAllFileTypes(wxArrayString& mimetypes); // these are NOPs under OS/2 - bool ReadMailcap(const wxString& filename, bool fallback = TRUE) - { return TRUE; } - bool ReadMimeTypes(const wxString& filename) - { return TRUE; } + bool ReadMailcap(const wxString& WXUNUSED(filename), bool WXUNUSED(fallback) = true) + { return true; } + bool ReadMimeTypes(const wxString& WXUNUSED(filename)) + { return true; } void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); } @@ -116,4 +116,3 @@ private: #endif //_MIMETYPE_IMPL_H - diff --git a/include/wx/os2/private.h b/include/wx/os2/private.h index b97c2bac5c..c2f24820dd 100644 --- a/include/wx/os2/private.h +++ b/include/wx/os2/private.h @@ -19,18 +19,22 @@ #define INCL_GPI #define INCL_WINSYS #define INCL_SHLERRORS +#define INCL_DOS #include + #if defined (__EMX__) && !defined(USE_OS2_TOOLKIT_HEADERS) && !defined(HAVE_SPBCDATA) - typedef struct _SPBCDATA { - ULONG cbSize; /* Size of control block. */ - ULONG ulTextLimit; /* Entryfield text limit. */ - LONG lLowerLimit; /* Spin lower limit (numeric only). */ - LONG lUpperLimit; /* Spin upper limit (numeric only). */ - ULONG idMasterSpb; /* ID of the servant's master spinbutton. */ - PVOID pHWXCtlData; /* Handwriting control data structure flag. */ - } SPBCDATA; - - typedef SPBCDATA *PSPBCDATA; + + typedef struct _SPBCDATA { + ULONG cbSize; /* Size of control block. */ + ULONG ulTextLimit; /* Entryfield text limit. */ + LONG lLowerLimit; /* Spin lower limit (numeric only). */ + LONG lUpperLimit; /* Spin upper limit (numeric only). */ + ULONG idMasterSpb; /* ID of the servant's master spinbutton. */ + PVOID pHWXCtlData; /* Handwriting control data structure flag. */ + } SPBCDATA; + + typedef SPBCDATA *PSPBCDATA; + #endif #include "wx/fontenc.h" @@ -146,11 +150,11 @@ typedef MRESULT (APIENTRY * WndProcCast) (HWND, ULONG, MPARAM, MPARAM); #define STATIC_FLAGS (SS_TEXT|DT_LEFT|SS_LEFT|WS_VISIBLE) #define CHECK_CLASS _T("BUTTON") #define CHECK_FLAGS (BS_AUTOCHECKBOX|WS_TABSTOP) -#define CHECK_IS_FAFA FALSE +#define CHECK_IS_FAFA FALSE #define RADIO_CLASS _T("BUTTON" ) #define RADIO_FLAGS (BS_AUTORADIOBUTTON|WS_VISIBLE) #define RADIO_SIZE 20 -#define RADIO_IS_FAFA FALSE +#define RADIO_IS_FAFA FALSE #define PURE_WINDOWS /* PM has no group box button style #define GROUP_CLASS "BUTTON" @@ -193,6 +197,34 @@ extern LONG APIENTRY wxSubclassedGenericControlProc(WXHWND hWnd, WXDWORD message #define ENDSESSION_LOGOFF 0x80000000 #endif +#ifndef PMERR_INVALID_PARM + #define PMERR_INVALID_PARM 0x1303 +#endif + +#ifndef PMERR_INVALID_PARAMETERS + #define PMERR_INVALID_PARAMETERS 0x1208 +#endif + +#ifndef BOOKERR_INVALID_PARAMETERS + #define BOOKERR_INVALID_PARAMETERS -1 +#endif + +#ifndef DLGC_ENTRYFIELD + #define DLGC_ENTRYFIELD 0x0001 +#endif + +#ifndef DLGC_BUTTON + #define DLGC_BUTTON 0x0002 +#endif + +#ifndef DLGC_MLE + #define DLGC_MLE 0x0400 +#endif + +#ifndef DP_NORMAL + #define DP_NORMAL 0 +#endif + // --------------------------------------------------------------------------- // debug messages -- OS/2 has no native debug output system // --------------------------------------------------------------------------- diff --git a/include/wx/os2/spinctrl.h b/include/wx/os2/spinctrl.h index 5a0983870b..8e7feec3a4 100644 --- a/include/wx/os2/spinctrl.h +++ b/include/wx/os2/spinctrl.h @@ -15,7 +15,7 @@ #include "wx/spinbutt.h" // the base class #include "wx/dynarray.h" class WXDLLEXPORT wxSpinCtrl; -WX_DEFINE_EXPORTED_ARRAY(wxSpinCtrl *, wxArraySpins); +WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins); // ---------------------------------------------------------------------------- // Under Win32 and OS2 PM, wxSpinCtrl is a wxSpinButton with a buddy @@ -28,7 +28,7 @@ class WXDLLEXPORT wxSpinCtrl : public wxSpinButton public: wxSpinCtrl() { } wxSpinCtrl( wxWindow* pParent - ,wxWindowID vId = -1 + ,wxWindowID vId = wxID_ANY ,const wxString& rsValue = wxEmptyString ,const wxPoint& rPos = wxDefaultPosition ,const wxSize& rSize = wxDefaultSize @@ -44,7 +44,7 @@ public: virtual ~wxSpinCtrl(); bool Create(wxWindow* pParent - ,wxWindowID vId = -1 + ,wxWindowID vId = wxID_ANY ,const wxString& rsValue = wxEmptyString ,const wxPoint& rPos = wxDefaultPosition ,const wxSize& rSize = wxDefaultSize @@ -65,23 +65,23 @@ public: // implementation only from now on // ------------------------------- // - virtual bool Enable(bool bEnable = TRUE); + virtual bool Enable(bool bEnable = true); - virtual int GetValue(void) const; + virtual int GetValue(void) const; + + virtual bool SetFont(const wxFont &rFont); + virtual void SetFocus(void); - virtual bool SetFont(const wxFont &rFont); - virtual void SetFocus(void); inline virtual void SetValue(int nVal) { wxSpinButton::SetValue(nVal); } - void SetSelection( long lFrom - ,long lTo - ); - virtual bool Show(bool bShow = TRUE); + void SetSelection(long lFrom, long lTo); + + virtual bool Show(bool bShow = true); // // wxSpinButton doesn't accept focus, but we do // - inline virtual bool AcceptsFocus(void) const { return FALSE; } + inline virtual bool AcceptsFocus(void) const { return false; } // // Return the spinctrl object whose buddy is the given window or NULL @@ -126,5 +126,3 @@ private: }; // end of CLASS wxSpinCtrl #endif // _WX_MSW_SPINCTRL_H_ - - diff --git a/include/wx/os2/tooltip.h b/include/wx/os2/tooltip.h index 8ec7fd5abc..1a1bc252ad 100644 --- a/include/wx/os2/tooltip.h +++ b/include/wx/os2/tooltip.h @@ -27,9 +27,9 @@ public: // controlling tooltip behaviour: globally change tooltip parameters // enable or disable the tooltips globally - static void Enable(bool flag) {} + static void Enable(bool WXUNUSED(flag)) {} // set the delay after which the tooltip appears - static void SetDelay(long milliseconds) {} + static void SetDelay(long WXUNUSED(milliseconds)) {} // // Implementation @@ -44,4 +44,3 @@ private: wxString m_sText; // tooltip text wxWindow* m_pWindow; // window we're associated with }; // end of CLASS wxToolTip - diff --git a/src/unix/gsocket.cpp b/src/unix/gsocket.cpp index 1328df7bde..6e3cf62fa5 100644 --- a/src/unix/gsocket.cpp +++ b/src/unix/gsocket.cpp @@ -16,6 +16,12 @@ * PLEASE don't put C++ comments here - this is a C source file. */ +#if defined(__WATCOMC__) +#include "wx/wxprec.h" +#include +#include +#endif + #ifndef __GSOCKET_STANDALONE__ #include "wx/setup.h" #endif @@ -118,7 +124,7 @@ int _System soclose(int); # define SOCKLEN_T socklen_t # endif # elif defined(__WXMAC__) -# define SOCKLEN_T socklen_t +# define SOCKLEN_T socklen_t # else # define SOCKLEN_T int # endif @@ -150,15 +156,24 @@ int _System soclose(int); #define INADDR_NONE INADDR_BROADCAST #endif -#define MASK_SIGNAL() \ -{ \ - void (*old_handler)(int); \ - \ - old_handler = signal(SIGPIPE, SIG_IGN); +#if defined(__VISAGECPP__) || defined(__WATCOMC__) -#define UNMASK_SIGNAL() \ - signal(SIGPIPE, old_handler); \ -} + #define MASK_SIGNAL() { + #define UNMASK_SIGNAL() } + +#else + + #define MASK_SIGNAL() \ + { \ + void (*old_handler)(int); \ + \ + old_handler = signal(SIGPIPE, SIG_IGN); + + #define UNMASK_SIGNAL() \ + signal(SIGPIPE, old_handler); \ + } + +#endif /* If a SIGPIPE is issued by a socket call on a remotely closed socket, the program will "crash" unless it explicitly handles the SIGPIPE. @@ -906,7 +921,7 @@ int GSocket::Write(const char *buffer, int size) if (ret == -1) { - if ((errno == EWOULDBLOCK) || (errno == EAGAIN)) + if ((errno == EWOULDBLOCK) || (errno == EAGAIN)) { m_error = GSOCK_WOULDBLOCK; GSocket_Debug(( "GSocket_Write error WOULDBLOCK\n" )); @@ -1303,7 +1318,7 @@ GSocketError GSocket::Output_Timeout() int GSocket::Recv_Stream(char *buffer, int size) { int ret; - do + do { ret = recv(m_fd, buffer, size, GSOCKET_MSG_NOSIGNAL); } while (ret == -1 && errno == EINTR); /* Loop until not interrupted */ @@ -1319,7 +1334,7 @@ int GSocket::Recv_Dgram(char *buffer, int size) fromlen = sizeof(from); - do + do { ret = recvfrom(m_fd, buffer, size, 0, &from, (SOCKLEN_T *) &fromlen); } while (ret == -1 && errno == EINTR); /* Loop until not interrupted */ @@ -1353,16 +1368,14 @@ int GSocket::Send_Stream(const char *buffer, int size) { int ret; -#ifndef __VISAGECPP__ - MASK_SIGNAL(); -#endif - do + MASK_SIGNAL(); + + do { ret = send(m_fd, (char *)buffer, size, GSOCKET_MSG_NOSIGNAL); } while (ret == -1 && errno == EINTR); /* Loop until not interrupted */ -#ifndef __VISAGECPP__ + UNMASK_SIGNAL(); -#endif return ret; } @@ -1386,16 +1399,14 @@ int GSocket::Send_Dgram(const char *buffer, int size) return -1; } -#ifndef __VISAGECPP__ MASK_SIGNAL(); -#endif - do + + do { ret = sendto(m_fd, (char *)buffer, size, 0, addr, len); } while (ret == -1 && errno == EINTR); /* Loop until not interrupted */ -#ifndef __VISAGECPP__ + UNMASK_SIGNAL(); -#endif /* Frees memory allocated from _GAddress_translate_to */ free(addr); @@ -1440,15 +1451,15 @@ void GSocket::Detected_Read() else { /* Do not throw a lost event in cases where the socket isn't really lost */ - if ((errno == EWOULDBLOCK) || (errno == EAGAIN) || (errno == EINTR)) + if ((errno == EWOULDBLOCK) || (errno == EAGAIN) || (errno == EINTR)) { CALL_CALLBACK(this, GSOCK_INPUT); } - else + else { CALL_CALLBACK(this, GSOCK_LOST); Shutdown(); - } + } } } } @@ -1916,4 +1927,3 @@ GSocketError GAddress_UNIX_GetPath(GAddress *address, char *path, size_t sbuf) } #endif /* !defined(__VISAGECPP__) */ #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ - -- 2.45.2