mac support as stubs added
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1303 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
5bd22e2636
commit
17dff81c71
@ -222,7 +222,11 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
static bool IsImmutable(const wxString& key)
|
static bool IsImmutable(const wxString& key)
|
||||||
|
#ifndef __WXMAC__
|
||||||
{ return !key.IsEmpty() && key[0u] == wxCONFIG_IMMUTABLE_PREFIX; }
|
{ return !key.IsEmpty() && key[0u] == wxCONFIG_IMMUTABLE_PREFIX; }
|
||||||
|
#else
|
||||||
|
{ return !key.IsEmpty() && key[0ul] == wxCONFIG_IMMUTABLE_PREFIX; }
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// are we doing automatic environment variable expansion?
|
// are we doing automatic environment variable expansion?
|
||||||
|
@ -306,6 +306,11 @@ WXDLLEXPORT_DATA(extern const bool) wxFalse;
|
|||||||
#undef except
|
#undef except
|
||||||
#undef finally
|
#undef finally
|
||||||
#define except(x) catch(...)
|
#define except(x) catch(...)
|
||||||
|
#elif defined(__MWERKS__)
|
||||||
|
#undef try
|
||||||
|
#undef except
|
||||||
|
#undef finally
|
||||||
|
#define except(x) catch(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// where should i put this? we need to make sure of this as it breaks
|
// where should i put this? we need to make sure of this as it breaks
|
||||||
|
@ -23,7 +23,11 @@
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// define off_t
|
// define off_t
|
||||||
|
#ifndef __WXMAC__
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#else
|
||||||
|
typedef long off_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define off_t _off_t
|
#define off_t _off_t
|
||||||
@ -77,6 +81,11 @@ WXDLLEXPORT void wxDos2UnixFilename(char *s);
|
|||||||
WXDLLEXPORT void wxUnix2DosFilename(char *s);
|
WXDLLEXPORT void wxUnix2DosFilename(char *s);
|
||||||
#define Unix2DosFilename wxUnix2DosFilename
|
#define Unix2DosFilename wxUnix2DosFilename
|
||||||
|
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
WXDLLEXPORT void wxMacPathToFSSpec( const char *path , FSSpec *spec ) ;
|
||||||
|
WXDLLEXPORT void wxMac2UnixFilename(char *s);
|
||||||
|
WXDLLEXPORT void wxUnix2MacFilename(char *s);
|
||||||
|
#endif
|
||||||
// Strip the extension, in situ
|
// Strip the extension, in situ
|
||||||
WXDLLEXPORT void wxStripExtension(char *buffer);
|
WXDLLEXPORT void wxStripExtension(char *buffer);
|
||||||
WXDLLEXPORT void wxStripExtension(wxString& buffer);
|
WXDLLEXPORT void wxStripExtension(wxString& buffer);
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef __WXMSW__
|
#if !defined( __WXMSW__ ) && !defined( __WXMAC__)
|
||||||
#define wxMessageDialog wxGenericMessageDialog
|
#define wxMessageDialog wxGenericMessageDialog
|
||||||
|
|
||||||
int wxMessageBox(const wxString& message, const wxString& caption = wxMessageBoxCaptionStr,
|
int wxMessageBox(const wxString& message, const wxString& caption = wxMessageBoxCaptionStr,
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#elif defined(__WXQT__)
|
#elif defined(__WXQT__)
|
||||||
#include "wx/generic/msgdlgg.h"
|
#include "wx/generic/msgdlgg.h"
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
#include "wx/generic/msgdlgg.h"
|
#include "wx/mac/msgdlg.h"
|
||||||
#elif defined(__WXSTUBS__)
|
#elif defined(__WXSTUBS__)
|
||||||
#include "wx/generic/msgdlgg.h"
|
#include "wx/generic/msgdlgg.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -80,6 +80,9 @@ class WXDLLEXPORT wxSocketHandler;
|
|||||||
class WXDLLEXPORT wxSocketBase : public wxEvtHandler
|
class WXDLLEXPORT wxSocketBase : public wxEvtHandler
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(wxSocketBase)
|
DECLARE_CLASS(wxSocketBase)
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
friend void wxMacSocketOnRequestProc(void *refcon , short event) ;
|
||||||
|
#endif
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum wxSockFlags { NONE=0, NOWAIT=1, WAITALL=2, SPEED=4 };
|
enum wxSockFlags { NONE=0, NOWAIT=1, WAITALL=2, SPEED=4 };
|
||||||
@ -329,6 +332,8 @@ public:
|
|||||||
|
|
||||||
typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&);
|
typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&);
|
||||||
|
|
||||||
|
#define wxEVT_SOCKET wxEVT_FIRST+301
|
||||||
|
|
||||||
#define EVT_SOCKET(id, func) { wxEVT_SOCKET, id, 0, \
|
#define EVT_SOCKET(id, func) { wxEVT_SOCKET, id, 0, \
|
||||||
(wxObjectEventFunction) (wxEventFunction) (wxSocketEventFunction) & func, \
|
(wxObjectEventFunction) (wxEventFunction) (wxSocketEventFunction) & func, \
|
||||||
(wxObject *) NULL },
|
(wxObject *) NULL },
|
||||||
|
@ -22,6 +22,9 @@
|
|||||||
* stdarg.h
|
* stdarg.h
|
||||||
* limits.h
|
* limits.h
|
||||||
*/
|
*/
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
#include <ctype.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@ -93,6 +96,14 @@ inline int WXDLLEXPORT Stricmp(const char *psz1, const char *psz2)
|
|||||||
return stricmp(psz1, psz2);
|
return stricmp(psz1, psz2);
|
||||||
#elif defined(__UNIX__) || defined(__GNUWIN32__)
|
#elif defined(__UNIX__) || defined(__GNUWIN32__)
|
||||||
return strcasecmp(psz1, psz2);
|
return strcasecmp(psz1, psz2);
|
||||||
|
#elif defined(__MWERKS__) && !defined(_MSC_VER)
|
||||||
|
register char c1, c2;
|
||||||
|
do {
|
||||||
|
c1 = tolower(*psz1++);
|
||||||
|
c2 = tolower(*psz2++);
|
||||||
|
} while ( c1 && (c1 == c2) );
|
||||||
|
|
||||||
|
return c1 - c2;
|
||||||
#else
|
#else
|
||||||
// almost all compilers/libraries provide this function (unfortunately under
|
// almost all compilers/libraries provide this function (unfortunately under
|
||||||
// different names), that's why we don't implement our own which will surely
|
// different names), that's why we don't implement our own which will surely
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
#elif defined(__WXQT__)
|
#elif defined(__WXQT__)
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
|
#include "wx/mac/taskbar.h"
|
||||||
#elif defined(__WXSTUBS__)
|
#elif defined(__WXSTUBS__)
|
||||||
#include "wx/stubs/taskbar.h"
|
#include "wx/stubs/taskbar.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,38 +11,28 @@
|
|||||||
|
|
||||||
#ifndef _WX_CW__
|
#ifndef _WX_CW__
|
||||||
#define _WX_CW__
|
#define _WX_CW__
|
||||||
#define MSL_USE_PRECOMPILED_HEADERS 1
|
|
||||||
|
|
||||||
#if !defined( __MWERKS__ )
|
#ifdef __cplusplus
|
||||||
#error "this file is only for builds with Metrowerks CodeWarrior"
|
#if __POWERPC__
|
||||||
#endif
|
#include <wx_PPC++.mch>
|
||||||
|
#elif __INTEL__
|
||||||
#define WX_COMP_INLINE_NO_CLASS // defined if the compiler does not want the classname repeated for inlines within a class definition
|
#include <wx_x86++.mch>
|
||||||
|
#elif __CFM68K__
|
||||||
#if (__MWERKS__ < 0x0900) || macintosh
|
#include <wx_cfm++.mch>
|
||||||
#define __MAC__
|
#else
|
||||||
#define __WXMAC__
|
#include <wx_68k++.mch>
|
||||||
#define USE_PRECOMPILED_MAC_HEADERS 1 /*Set to 0 if you don't want to use precompiled MacHeaders*/
|
#endif
|
||||||
#include <ansi_prefix.mac.h>
|
#else
|
||||||
#define WX_PRECOMP
|
#if __POWERPC__
|
||||||
// automatically includes MacHeaders
|
#include <wx_PPC.mch>
|
||||||
#elif (__MWERKS__ >= 0x0900) && __INTEL__
|
#elif __INTEL__
|
||||||
#define __WXMSW__
|
#include <wx_x86.mch>
|
||||||
#define __WINDOWS__
|
#elif __CFM68K__
|
||||||
#define __WIN95__
|
#include <wx_cfm.mch>
|
||||||
#define STRICT
|
#else
|
||||||
#define NOMINMAX
|
#include <wx_68k.mch>
|
||||||
#include <ansi_prefix.win32.h>
|
#endif
|
||||||
#elif __BEOS__
|
|
||||||
#include <ansi_prefix.be.h>
|
|
||||||
#include <Be.h>
|
|
||||||
#else
|
|
||||||
#error unknown MW compiler
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// in order to avoid problems further down in wxWindows
|
|
||||||
|
|
||||||
char *strdup(const char *s) ;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_CW__
|
// _WX_CW__
|
||||||
|
@ -12,49 +12,27 @@
|
|||||||
#ifndef _WX_CW__
|
#ifndef _WX_CW__
|
||||||
#define _WX_CW__
|
#define _WX_CW__
|
||||||
|
|
||||||
#define MSL_USE_PRECOMPILED_HEADERS 1
|
|
||||||
|
|
||||||
#if !defined( __MWERKS__ )
|
|
||||||
#error "this file is only for builds with Metrowerks CodeWarrior"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define WX_COMP_INLINE_NO_CLASS // defined if the compiler does not want the classname repeated for inlines within a class definition
|
|
||||||
|
|
||||||
#if (__MWERKS__ < 0x0900) || macintosh
|
|
||||||
#define __MAC__
|
|
||||||
#define __WXMAC__
|
|
||||||
#define USE_PRECOMPILED_MAC_HEADERS 1 /*Set to 0 if you don't want to use precompiled MacHeaders*/
|
|
||||||
#include <ansi_prefix.mac.h>
|
|
||||||
#define WX_PRECOMP
|
|
||||||
// automatically includes MacHeaders
|
|
||||||
#elif (__MWERKS__ >= 0x0900) && __INTEL__
|
|
||||||
#define __WXMSW__
|
|
||||||
#define __WINDOWS__
|
|
||||||
#define __WIN95__
|
|
||||||
#define STRICT
|
|
||||||
#define NOMINMAX
|
|
||||||
#include <ansi_prefix.win32.h>
|
|
||||||
// #include <Windows.h>
|
|
||||||
// #include <COMMCTRL.H>
|
|
||||||
#elif __BEOS__
|
|
||||||
#include <ansi_prefix.be.h>
|
|
||||||
#include <Be.h>
|
|
||||||
#else
|
|
||||||
#error unknown MW compiler
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define __WXDEBUG__
|
|
||||||
#define USE_DEFINE
|
|
||||||
// in order to avoid problems further down in wxWindows
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
#if __POWERPC__
|
||||||
{
|
#include <wx_PPC++_d.mch>
|
||||||
#endif
|
#elif __INTEL__
|
||||||
char *strdup(const char *s) ;
|
#include <wx_x86++_d.mch>
|
||||||
int isascii( int c ) ;
|
#elif __CFM68K__
|
||||||
#ifdef __cplusplus
|
#include <wx_cfm++_d.mch>
|
||||||
} ;
|
#else
|
||||||
|
#include <wx_68k++_d.mch>
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if __POWERPC__
|
||||||
|
#include <wx_PPC_d.mch>
|
||||||
|
#elif __INTEL__
|
||||||
|
#include <wx_x86_d.mch>
|
||||||
|
#elif __CFM68K__
|
||||||
|
#include <wx_cfm_d.mch>
|
||||||
|
#else
|
||||||
|
#include <wx_68k_d.mch>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_CW__
|
// _WX_CW__
|
||||||
|
@ -117,9 +117,20 @@ void *wxLibrary::GetSymbol(const wxString& symbname)
|
|||||||
{
|
{
|
||||||
#if defined(__UNIX__)
|
#if defined(__UNIX__)
|
||||||
return dlsym(m_handle, WXSTRINGCAST symbname);
|
return dlsym(m_handle, WXSTRINGCAST symbname);
|
||||||
#endif
|
#elif defined( __WINDOWS__ )
|
||||||
#ifdef __WINDOWS__
|
|
||||||
return GetProcAddress((HINSTANCE) m_handle, WXSTRINGCAST symbname);
|
return GetProcAddress((HINSTANCE) m_handle, WXSTRINGCAST symbname);
|
||||||
|
#elif defined( __WXMAC__ )
|
||||||
|
Ptr symAddress ;
|
||||||
|
CFragSymbolClass symClass ;
|
||||||
|
Str255 symName ;
|
||||||
|
|
||||||
|
strcpy( (char*) symName , symbname ) ;
|
||||||
|
c2pstr( (char*) symName ) ;
|
||||||
|
|
||||||
|
if ( FindSymbol( (CFragConnectionID) m_handle , symName , &symAddress , &symClass ) == noErr )
|
||||||
|
{
|
||||||
|
return symAddress ;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -184,6 +195,20 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name)
|
|||||||
#endif
|
#endif
|
||||||
if (!handle)
|
if (!handle)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
#elif defined(__WXMAC__)
|
||||||
|
FSSpec myFSSpec ;
|
||||||
|
CFragConnectionID handle ;
|
||||||
|
Ptr myMainAddr ;
|
||||||
|
Str255 myErrName ;
|
||||||
|
|
||||||
|
wxMacPathToFSSpec( lib_name , &myFSSpec ) ;
|
||||||
|
if (GetDiskFragment( &myFSSpec , 0 , kCFragGoesToEOF , "\p" , kPrivateCFragCopy , &handle , &myMainAddr ,
|
||||||
|
myErrName ) != noErr )
|
||||||
|
{
|
||||||
|
p2cstr( myErrName ) ;
|
||||||
|
wxASSERT_MSG( 1 , (char*)myErrName ) ;
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -56,6 +56,13 @@
|
|||||||
#elif (defined(__WXSTUBS__))
|
#elif (defined(__WXSTUBS__))
|
||||||
// Have to ifdef this for different environments
|
// Have to ifdef this for different environments
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#elif (defined(__WXMAC__))
|
||||||
|
int access( const char *path, int mode ) { return 0 ; }
|
||||||
|
char* mktemp( char * path ) { return path ;}
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <unix.h>
|
||||||
|
#define W_OK 2
|
||||||
|
#define R_OK 4
|
||||||
#else
|
#else
|
||||||
#error "Please specify the header with file functions declarations."
|
#error "Please specify the header with file functions declarations."
|
||||||
#endif //Win/UNIX
|
#endif //Win/UNIX
|
||||||
@ -443,7 +450,7 @@ bool wxTempFile::Open(const wxString& strName)
|
|||||||
// otherwise rename() in Commit() might not work (if the files are on
|
// otherwise rename() in Commit() might not work (if the files are on
|
||||||
// different partitions for example). Unfortunately, the only standard
|
// different partitions for example). Unfortunately, the only standard
|
||||||
// (POSIX) temp file creation function tmpnam() can't do it.
|
// (POSIX) temp file creation function tmpnam() can't do it.
|
||||||
#if defined(__UNIX__) || defined(__WXSTUBS__)
|
#if defined(__UNIX__) || defined(__WXSTUBS__)|| defined( __WXMAC__ )
|
||||||
static const char *szMktempSuffix = "XXXXXX";
|
static const char *szMktempSuffix = "XXXXXX";
|
||||||
m_strTemp << strName << szMktempSuffix;
|
m_strTemp << strName << szMktempSuffix;
|
||||||
mktemp((char *)m_strTemp.c_str()); // will do because length doesn't change
|
mktemp((char *)m_strTemp.c_str()); // will do because length doesn't change
|
||||||
|
@ -97,6 +97,8 @@ wxString wxFileConfig::GetGlobalDir()
|
|||||||
strDir = "/etc/";
|
strDir = "/etc/";
|
||||||
#elif defined(__WXSTUBS__)
|
#elif defined(__WXSTUBS__)
|
||||||
wxASSERT_MSG( FALSE, "TODO" ) ;
|
wxASSERT_MSG( FALSE, "TODO" ) ;
|
||||||
|
#elif defined(__WXMAC__)
|
||||||
|
wxASSERT_MSG( FALSE, "TODO" ) ;
|
||||||
#else // Windows
|
#else // Windows
|
||||||
char szWinDir[MAX_PATH];
|
char szWinDir[MAX_PATH];
|
||||||
::GetWindowsDirectory(szWinDir, MAX_PATH);
|
::GetWindowsDirectory(szWinDir, MAX_PATH);
|
||||||
|
@ -88,6 +88,11 @@
|
|||||||
#define _MAXPATHLEN 500
|
#define _MAXPATHLEN 500
|
||||||
|
|
||||||
extern char *wxBuffer;
|
extern char *wxBuffer;
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
extern char gwxMacFileName[] ;
|
||||||
|
extern char gwxMacFileName2[] ;
|
||||||
|
extern char gwxMacFileName3[] ;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARIES
|
#if !USE_SHARED_LIBRARIES
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxStringList)
|
IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxStringList)
|
||||||
@ -147,7 +152,7 @@ bool wxPathList::Member (const wxString& path)
|
|||||||
{
|
{
|
||||||
wxString path2((char *) node->Data ());
|
wxString path2((char *) node->Data ());
|
||||||
if (
|
if (
|
||||||
#if defined(__WINDOWS__) || defined(__VMS__)
|
#if defined(__WINDOWS__) || defined(__VMS__) || defined (__WXMAC__)
|
||||||
// Case INDEPENDENT
|
// Case INDEPENDENT
|
||||||
path.CompareTo (path2, wxString::ignoreCase) == 0
|
path.CompareTo (path2, wxString::ignoreCase) == 0
|
||||||
#else
|
#else
|
||||||
@ -225,6 +230,13 @@ wxFileExists (const wxString& filename)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
else
|
else
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
#elif defined(__WXMAC__)
|
||||||
|
struct stat stbuf;
|
||||||
|
strcpy( gwxMacFileName , filename ) ;
|
||||||
|
wxUnix2MacFilename( gwxMacFileName ) ;
|
||||||
|
if (gwxMacFileName && stat ((char *)(const char *)gwxMacFileName, &stbuf) == 0)
|
||||||
|
return TRUE;
|
||||||
|
return FALSE ;
|
||||||
#else
|
#else
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
|
|
||||||
@ -738,6 +750,58 @@ wxString wxPathOnly (const wxString& path)
|
|||||||
// and back again - or we get nasty problems with delimiters.
|
// and back again - or we get nasty problems with delimiters.
|
||||||
// Also, convert to lower case, since case is significant in UNIX.
|
// Also, convert to lower case, since case is significant in UNIX.
|
||||||
|
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
void
|
||||||
|
wxMac2UnixFilename (char *s)
|
||||||
|
{
|
||||||
|
if (s)
|
||||||
|
{
|
||||||
|
memmove( s+1 , s ,strlen( s ) + 1) ;
|
||||||
|
if ( *s == ':' )
|
||||||
|
*s = '.' ;
|
||||||
|
else
|
||||||
|
*s = '/' ;
|
||||||
|
|
||||||
|
while (*s)
|
||||||
|
{
|
||||||
|
if (*s == ':')
|
||||||
|
*s = '/';
|
||||||
|
else
|
||||||
|
*s = wxToLower (*s); // Case INDEPENDENT
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wxUnix2MacFilename (char *s)
|
||||||
|
{
|
||||||
|
if (s)
|
||||||
|
{
|
||||||
|
if ( *s == '.' )
|
||||||
|
{
|
||||||
|
// relative path , since it goes on with slash which is translated to a :
|
||||||
|
memmove( s , s+1 ,strlen( s ) ) ;
|
||||||
|
}
|
||||||
|
else if ( *s == '/' )
|
||||||
|
{
|
||||||
|
// absolute path -> on mac just start with the drive name
|
||||||
|
memmove( s , s+1 ,strlen( s ) ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( 1 , "unkown path beginning" ) ;
|
||||||
|
}
|
||||||
|
while (*s)
|
||||||
|
{
|
||||||
|
if (*s == '/' || *s == '\\')
|
||||||
|
*s = ':';
|
||||||
|
|
||||||
|
s++ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
void
|
void
|
||||||
wxDos2UnixFilename (char *s)
|
wxDos2UnixFilename (char *s)
|
||||||
{
|
{
|
||||||
@ -783,9 +847,22 @@ wxConcatFiles (const wxString& file1, const wxString& file2, const wxString& fil
|
|||||||
FILE *fp2 = (FILE *) NULL;
|
FILE *fp2 = (FILE *) NULL;
|
||||||
FILE *fp3 = (FILE *) NULL;
|
FILE *fp3 = (FILE *) NULL;
|
||||||
// Open the inputs and outputs
|
// Open the inputs and outputs
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
strcpy( gwxMacFileName , file1 ) ;
|
||||||
|
wxUnix2MacFilename( gwxMacFileName ) ;
|
||||||
|
strcpy( gwxMacFileName2 , file2) ;
|
||||||
|
wxUnix2MacFilename( gwxMacFileName2 ) ;
|
||||||
|
strcpy( gwxMacFileName3 , outfile) ;
|
||||||
|
wxUnix2MacFilename( gwxMacFileName3 ) ;
|
||||||
|
|
||||||
|
if ((fp1 = fopen (gwxMacFileName, "rb")) == NULL ||
|
||||||
|
(fp2 = fopen (gwxMacFileName2, "rb")) == NULL ||
|
||||||
|
(fp3 = fopen (gwxMacFileName3, "wb")) == NULL)
|
||||||
|
#else
|
||||||
if ((fp1 = fopen (WXSTRINGCAST file1, "rb")) == NULL ||
|
if ((fp1 = fopen (WXSTRINGCAST file1, "rb")) == NULL ||
|
||||||
(fp2 = fopen (WXSTRINGCAST file2, "rb")) == NULL ||
|
(fp2 = fopen (WXSTRINGCAST file2, "rb")) == NULL ||
|
||||||
(fp3 = fopen (outfile, "wb")) == NULL)
|
(fp3 = fopen (outfile, "wb")) == NULL)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (fp1)
|
if (fp1)
|
||||||
fclose (fp1);
|
fclose (fp1);
|
||||||
@ -819,9 +896,20 @@ wxCopyFile (const wxString& file1, const wxString& file2)
|
|||||||
FILE *fd2;
|
FILE *fd2;
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
strcpy( gwxMacFileName , file1 ) ;
|
||||||
|
wxUnix2MacFilename( gwxMacFileName ) ;
|
||||||
|
strcpy( gwxMacFileName2 , file2) ;
|
||||||
|
wxUnix2MacFilename( gwxMacFileName2 ) ;
|
||||||
|
|
||||||
|
if ((fd1 = fopen (gwxMacFileName, "rb")) == NULL)
|
||||||
|
return FALSE;
|
||||||
|
if ((fd2 = fopen (gwxMacFileName2, "wb")) == NULL)
|
||||||
|
#else
|
||||||
if ((fd1 = fopen (WXSTRINGCAST file1, "rb")) == NULL)
|
if ((fd1 = fopen (WXSTRINGCAST file1, "rb")) == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if ((fd2 = fopen (WXSTRINGCAST file2, "wb")) == NULL)
|
if ((fd2 = fopen (WXSTRINGCAST file2, "wb")) == NULL)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
fclose (fd1);
|
fclose (fd1);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -838,9 +926,19 @@ wxCopyFile (const wxString& file1, const wxString& file2)
|
|||||||
bool
|
bool
|
||||||
wxRenameFile (const wxString& file1, const wxString& file2)
|
wxRenameFile (const wxString& file1, const wxString& file2)
|
||||||
{
|
{
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
strcpy( gwxMacFileName , file1 ) ;
|
||||||
|
wxUnix2MacFilename( gwxMacFileName ) ;
|
||||||
|
strcpy( gwxMacFileName2 , file2) ;
|
||||||
|
wxUnix2MacFilename( gwxMacFileName2 ) ;
|
||||||
|
|
||||||
|
if (0 == rename (gwxMacFileName, gwxMacFileName2))
|
||||||
|
return TRUE;
|
||||||
|
#else
|
||||||
// Normal system call
|
// Normal system call
|
||||||
if (0 == rename (WXSTRINGCAST file1, WXSTRINGCAST file2))
|
if (0 == rename (WXSTRINGCAST file1, WXSTRINGCAST file2))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
#endif
|
||||||
// Try to copy
|
// Try to copy
|
||||||
if (wxCopyFile(file1, file2)) {
|
if (wxCopyFile(file1, file2)) {
|
||||||
wxRemoveFile(file1);
|
wxRemoveFile(file1);
|
||||||
@ -854,6 +952,10 @@ bool wxRemoveFile(const wxString& file)
|
|||||||
{
|
{
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
|
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
|
||||||
int flag = remove(WXSTRINGCAST file);
|
int flag = remove(WXSTRINGCAST file);
|
||||||
|
#elif defined( __WXMAC__ )
|
||||||
|
strcpy( gwxMacFileName , file ) ;
|
||||||
|
wxUnix2MacFilename( gwxMacFileName ) ;
|
||||||
|
int flag = unlink(gwxMacFileName);
|
||||||
#else
|
#else
|
||||||
int flag = unlink(WXSTRINGCAST file);
|
int flag = unlink(WXSTRINGCAST file);
|
||||||
#endif
|
#endif
|
||||||
@ -866,6 +968,10 @@ bool wxMkdir(const wxString& dir)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
#elif defined(__VMS__)
|
#elif defined(__VMS__)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
#elif defined( __WXMAC__ )
|
||||||
|
strcpy( gwxMacFileName , dir ) ;
|
||||||
|
wxUnix2MacFilename( gwxMacFileName ) ;
|
||||||
|
return (mkdir(gwxMacFileName , 0 ) == 0);
|
||||||
#elif (defined(__GNUWIN32__) && !defined(__MINGW32__)) || !defined(__WXMSW__)
|
#elif (defined(__GNUWIN32__) && !defined(__MINGW32__)) || !defined(__WXMSW__)
|
||||||
return (mkdir (WXSTRINGCAST dir, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == 0);
|
return (mkdir (WXSTRINGCAST dir, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == 0);
|
||||||
#else
|
#else
|
||||||
@ -877,6 +983,10 @@ bool wxRmdir(const wxString& dir, int WXUNUSED(flags))
|
|||||||
{
|
{
|
||||||
#ifdef __VMS__
|
#ifdef __VMS__
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
#elif defined( __WXMAC__ )
|
||||||
|
strcpy( gwxMacFileName , dir ) ;
|
||||||
|
wxUnix2MacFilename( gwxMacFileName ) ;
|
||||||
|
return (rmdir(WXSTRINGCAST gwxMacFileName) == 0);
|
||||||
#else
|
#else
|
||||||
return (rmdir(WXSTRINGCAST dir) == 0);
|
return (rmdir(WXSTRINGCAST dir) == 0);
|
||||||
#endif
|
#endif
|
||||||
@ -1278,7 +1388,7 @@ char *wxGetWorkingDirectory(char *buf, int sz)
|
|||||||
|
|
||||||
bool wxSetWorkingDirectory(const wxString& d)
|
bool wxSetWorkingDirectory(const wxString& d)
|
||||||
{
|
{
|
||||||
#ifdef __UNIX__
|
#if defined( __UNIX__ ) || defined( __WXMAC__ )
|
||||||
return (chdir(d) == 0);
|
return (chdir(d) == 0);
|
||||||
#elif defined(__WINDOWS__)
|
#elif defined(__WINDOWS__)
|
||||||
|
|
||||||
|
@ -23,6 +23,10 @@
|
|||||||
#ifndef __MWERKS__
|
#ifndef __MWERKS__
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__WXMAC__)
|
||||||
|
#include "/wx/mac/macsock.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "wx/string.h"
|
#include "wx/string.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
|
@ -944,6 +944,12 @@ void Trap()
|
|||||||
DebugBreak();
|
DebugBreak();
|
||||||
#elif defined(__WXSTUBS__)
|
#elif defined(__WXSTUBS__)
|
||||||
// TODO
|
// TODO
|
||||||
|
#elif defined(__WXMAC__)
|
||||||
|
#if __powerc
|
||||||
|
Debugger();
|
||||||
|
#else
|
||||||
|
SysBreak();
|
||||||
|
#endif
|
||||||
#else // Unix
|
#else // Unix
|
||||||
raise(SIGTRAP);
|
raise(SIGTRAP);
|
||||||
#endif // Win/Unix
|
#endif // Win/Unix
|
||||||
|
@ -33,6 +33,10 @@
|
|||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
#include "wx/object.h"
|
#include "wx/object.h"
|
||||||
|
|
||||||
|
#if defined(__WXMAC__)
|
||||||
|
#include "/wx/mac/macsock.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__WINDOWS__)
|
#if defined(__WINDOWS__)
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#endif // __WINDOWS__
|
#endif // __WINDOWS__
|
||||||
@ -121,7 +125,11 @@ bool wxIPV4address::Hostname(const wxString& name)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
long len_addr = inet_addr(name.GetData()).s_addr ;
|
||||||
|
#else
|
||||||
long len_addr = inet_addr(name.GetData());
|
long len_addr = inet_addr(name.GetData());
|
||||||
|
#endif
|
||||||
if (len_addr == -1)
|
if (len_addr == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
m_addr->sin_addr.s_addr = len_addr;
|
m_addr->sin_addr.s_addr = len_addr;
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
// #pragma implementation "socket.cpp"
|
// #pragma implementation "socket.cpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
typedef int socklen_t ;
|
||||||
|
#endif
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
@ -41,6 +45,33 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// System specific headers
|
// System specific headers
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
// in order to avoid problems with our c library and double definitions
|
||||||
|
#define close closesocket
|
||||||
|
#define ioctl ioctlsocket
|
||||||
|
|
||||||
|
#include <wx/mac/macsock.h>
|
||||||
|
extern GUSISpinFn GUSISpin;
|
||||||
|
#define PROCESS_EVENTS() wxMacProcessEvents()
|
||||||
|
const short kwxMacNetEventsMax = 1000 ;
|
||||||
|
short wxMacNetEventsTop = 0 ;
|
||||||
|
short wxMacNetEventsBottom = 0 ;
|
||||||
|
short wxMacNetEventsEvents[kwxMacNetEventsMax] ;
|
||||||
|
void *wxMacNetEventsReferences[kwxMacNetEventsMax] ;
|
||||||
|
|
||||||
|
#define FD_READ 1
|
||||||
|
#define FD_WRITE 2
|
||||||
|
#define FD_CLOSE 4
|
||||||
|
#define FD_ACCEPT 8
|
||||||
|
#define FD_CONNECT 16
|
||||||
|
#define FD_READY 32
|
||||||
|
|
||||||
|
extern "C" void wxMacSocketHandlerProc( void *refcon , short event ) ; // adds events
|
||||||
|
extern "C" void wxMacSocketOnRequestProc( void *refcon , short event ) ; // consumes them
|
||||||
|
extern "C" void GUSISetReference( short sock , short eventmask , void * data ) ;
|
||||||
|
void wxMacProcessEvents() ;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__WINDOWS__)
|
#if defined(__WINDOWS__)
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#endif // __WINDOWS__
|
#endif // __WINDOWS__
|
||||||
@ -129,15 +160,15 @@
|
|||||||
#if defined( NEED_WSAFDIsSet ) || defined( _MSC_VER )
|
#if defined( NEED_WSAFDIsSet ) || defined( _MSC_VER )
|
||||||
int PASCAL FAR __WSAFDIsSet(SOCKET fd, fd_set FAR *set)
|
int PASCAL FAR __WSAFDIsSet(SOCKET fd, fd_set FAR *set)
|
||||||
{
|
{
|
||||||
int i = set->fd_count;
|
int i = set->fd_count;
|
||||||
|
|
||||||
while (i--)
|
while (i--)
|
||||||
{
|
{
|
||||||
if (set->fd_array[i] == fd)
|
if (set->fd_array[i] == fd)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -218,7 +249,7 @@ public:
|
|||||||
// --------- wxSocketBase CONSTRUCTOR ---------------------------
|
// --------- wxSocketBase CONSTRUCTOR ---------------------------
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
wxSocketBase::wxSocketBase(wxSocketBase::wxSockFlags _flags,
|
wxSocketBase::wxSocketBase(wxSocketBase::wxSockFlags _flags,
|
||||||
wxSocketBase::wxSockType _type) :
|
wxSocketBase::wxSockType _type) :
|
||||||
wxEvtHandler(),
|
wxEvtHandler(),
|
||||||
m_flags(_flags), m_type(_type), m_connected(FALSE), m_connecting(FALSE),
|
m_flags(_flags), m_type(_type), m_connected(FALSE), m_connecting(FALSE),
|
||||||
m_fd(INVALID_SOCKET), m_waitflags(0), m_cbk(0), m_cdata(0), m_id(-1),
|
m_fd(INVALID_SOCKET), m_waitflags(0), m_cbk(0), m_cdata(0), m_id(-1),
|
||||||
@ -624,7 +655,7 @@ bool wxSocketBase::WaitForLost(long seconds, long microseconds)
|
|||||||
#if defined(__WXMOTIF__) || defined(__WXXT__) || defined(__WXGTK__)
|
#if defined(__WXMOTIF__) || defined(__WXXT__) || defined(__WXGTK__)
|
||||||
#if defined(__WXMOTIF__) || defined(__WXXT__)
|
#if defined(__WXMOTIF__) || defined(__WXXT__)
|
||||||
static void wx_socket_read(XtPointer client, int *fid,
|
static void wx_socket_read(XtPointer client, int *fid,
|
||||||
XtInputId *WXUNUSED(id))
|
XtInputId *WXUNUSED(id))
|
||||||
#define fd *fid
|
#define fd *fid
|
||||||
#else
|
#else
|
||||||
static void wx_socket_read(gpointer client, gint fd,
|
static void wx_socket_read(gpointer client, gint fd,
|
||||||
@ -668,10 +699,10 @@ static void wx_socket_read(gpointer client, gint fd,
|
|||||||
|
|
||||||
#if defined(__WXMOTIF__) || defined(__WXXT__)
|
#if defined(__WXMOTIF__) || defined(__WXXT__)
|
||||||
static void wx_socket_write(XtPointer client, int *WXUNUSED(fid),
|
static void wx_socket_write(XtPointer client, int *WXUNUSED(fid),
|
||||||
XtInputId *WXUNUSED(id))
|
XtInputId *WXUNUSED(id))
|
||||||
#else
|
#else
|
||||||
static void wx_socket_write(gpointer client, gint WXUNUSED(fd),
|
static void wx_socket_write(gpointer client, gint WXUNUSED(fd),
|
||||||
GdkInputCondition WXUNUSED(cond))
|
GdkInputCondition WXUNUSED(cond))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxSocketBase *sock = (wxSocketBase *)client;
|
wxSocketBase *sock = (wxSocketBase *)client;
|
||||||
@ -795,7 +826,6 @@ void wxSocketBase::SetupCallbacks()
|
|||||||
if (m_fd == INVALID_SOCKET || !m_handler || (m_flags & SPEED))
|
if (m_fd == INVALID_SOCKET || !m_handler || (m_flags & SPEED))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
#if defined(__WXMOTIF__) || defined(__WXXT__)
|
#if defined(__WXMOTIF__) || defined(__WXXT__)
|
||||||
if (m_neededreq & (REQ_ACCEPT | REQ_READ | REQ_LOST))
|
if (m_neededreq & (REQ_ACCEPT | REQ_READ | REQ_LOST))
|
||||||
{
|
{
|
||||||
@ -894,6 +924,24 @@ void wxSocketBase::SetupCallbacks()
|
|||||||
if (!m_internal->my_msg)
|
if (!m_internal->my_msg)
|
||||||
m_internal->my_msg = m_handler->NewMessage(this);
|
m_internal->my_msg = m_handler->NewMessage(this);
|
||||||
WSAAsyncSelect(m_fd, m_handler->GetHWND(), m_internal->my_msg, mask);
|
WSAAsyncSelect(m_fd, m_handler->GetHWND(), m_internal->my_msg, mask);
|
||||||
|
#endif
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
short mask = 0;
|
||||||
|
|
||||||
|
if (m_neededreq & REQ_READ)
|
||||||
|
mask |= FD_READ;
|
||||||
|
if (m_neededreq & REQ_WRITE)
|
||||||
|
mask |= FD_WRITE;
|
||||||
|
if (m_neededreq & REQ_LOST)
|
||||||
|
mask |= FD_CLOSE;
|
||||||
|
if (m_neededreq & REQ_ACCEPT)
|
||||||
|
mask |= FD_ACCEPT;
|
||||||
|
if (m_neededreq & REQ_CONNECT)
|
||||||
|
mask |= FD_CONNECT;
|
||||||
|
|
||||||
|
GUSISetReference( m_fd ,mask, this ) ;
|
||||||
|
unsigned long flag = 1;
|
||||||
|
ioctl(m_fd, FIONBIO, &flag);
|
||||||
#endif
|
#endif
|
||||||
m_cbkon = TRUE;
|
m_cbkon = TRUE;
|
||||||
m_processing = FALSE;
|
m_processing = FALSE;
|
||||||
@ -925,6 +973,20 @@ void wxSocketBase::DestroyCallbacks()
|
|||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
WSAAsyncSelect(m_fd, m_handler->GetHWND(), 0, 0);
|
WSAAsyncSelect(m_fd, m_handler->GetHWND(), 0, 0);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
GUSISetReference( m_fd , 0 , 0 ) ;
|
||||||
|
int bottom = wxMacNetEventsBottom ;
|
||||||
|
while ( wxMacNetEventsTop != bottom )
|
||||||
|
{
|
||||||
|
// set all events that reference this socket to nil
|
||||||
|
if ( wxMacNetEventsReferences[bottom] == (void*) this )
|
||||||
|
wxMacNetEventsReferences[bottom] = NULL ;
|
||||||
|
bottom++ ;
|
||||||
|
if ( bottom == kwxMacNetEventsMax )
|
||||||
|
bottom = 0 ;
|
||||||
|
}
|
||||||
|
SetFlags( m_flags ) ;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSocketBase::Notify(bool notify)
|
void wxSocketBase::Notify(bool notify)
|
||||||
@ -1173,7 +1235,7 @@ void wxSocketBase::WantSpeedBuffer(char *buffer, size_t nbytes,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wxSocketBase::WantBuffer(char *buffer, size_t nbytes,
|
void wxSocketBase::WantBuffer(char *buffer, size_t nbytes,
|
||||||
wxRequestEvent evt)
|
wxRequestEvent evt)
|
||||||
{
|
{
|
||||||
bool buf_timed_out;
|
bool buf_timed_out;
|
||||||
|
|
||||||
@ -1230,7 +1292,7 @@ void wxSocketBase::WantBuffer(char *buffer, size_t nbytes,
|
|||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
|
|
||||||
wxSocketServer::wxSocketServer(wxSockAddress& addr_man,
|
wxSocketServer::wxSocketServer(wxSockAddress& addr_man,
|
||||||
wxSockFlags flags) :
|
wxSockFlags flags) :
|
||||||
wxSocketBase(flags, SOCK_SERVER)
|
wxSocketBase(flags, SOCK_SERVER)
|
||||||
{
|
{
|
||||||
m_fd = socket(addr_man.GetFamily(), SOCK_STREAM, 0);
|
m_fd = socket(addr_man.GetFamily(), SOCK_STREAM, 0);
|
||||||
@ -1321,7 +1383,7 @@ void wxSocketServer::OnRequest(wxRequestEvent evt)
|
|||||||
// --------- wxSocketClient CONSTRUCTOR -------------------------
|
// --------- wxSocketClient CONSTRUCTOR -------------------------
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
wxSocketClient::wxSocketClient(wxSockFlags _flags) :
|
wxSocketClient::wxSocketClient(wxSockFlags _flags) :
|
||||||
wxSocketBase(_flags, SOCK_CLIENT)
|
wxSocketBase(_flags, SOCK_CLIENT)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1430,6 +1492,64 @@ static int win_initialized = 0;
|
|||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
// --------- wxSocketHandler CONSTRUCTOR ------------------------
|
// --------- wxSocketHandler CONSTRUCTOR ------------------------
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
|
||||||
|
extern "C" int updatestatus(int s) ;
|
||||||
|
|
||||||
|
void wxMacSocketOnRequestProc( void *refcon , short event )
|
||||||
|
{
|
||||||
|
if ( refcon )
|
||||||
|
{
|
||||||
|
wxSocketBase *sock = (wxSocketBase *) refcon ;
|
||||||
|
|
||||||
|
wxSocketBase::wxRequestEvent sk_req;
|
||||||
|
|
||||||
|
int canRead ;
|
||||||
|
int canWrite ;
|
||||||
|
int exception ;
|
||||||
|
|
||||||
|
switch (event) {
|
||||||
|
case FD_READ:
|
||||||
|
sk_req = wxSocketBase::EVT_READ;
|
||||||
|
sock->OnRequest(sk_req);
|
||||||
|
break;
|
||||||
|
case FD_WRITE:
|
||||||
|
sk_req = wxSocketBase::EVT_WRITE;
|
||||||
|
sock->OnRequest(sk_req);
|
||||||
|
break;
|
||||||
|
case FD_CLOSE:
|
||||||
|
sk_req = wxSocketBase::EVT_LOST;
|
||||||
|
sock->OnRequest(sk_req);
|
||||||
|
break;
|
||||||
|
case FD_ACCEPT:
|
||||||
|
sk_req = wxSocketBase::EVT_ACCEPT;
|
||||||
|
sock->OnRequest(sk_req);
|
||||||
|
break;
|
||||||
|
case FD_CONNECT:
|
||||||
|
sk_req = wxSocketBase::EVT_CONNECT;
|
||||||
|
sock->OnRequest(sk_req);
|
||||||
|
break;
|
||||||
|
case FD_READY :
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
updatestatus ( sock->m_fd ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacSocketHandlerProc( void *refcon , short event )
|
||||||
|
{
|
||||||
|
wxMacNetEventsReferences[wxMacNetEventsTop] = refcon ;
|
||||||
|
wxMacNetEventsEvents[wxMacNetEventsTop] = event ;
|
||||||
|
|
||||||
|
// clumsy construct in order to never have a incorrect wxMacNetEventsTop (above limits)
|
||||||
|
|
||||||
|
if ( wxMacNetEventsTop + 1 == kwxMacNetEventsMax )
|
||||||
|
wxMacNetEventsTop = 0 ;
|
||||||
|
else
|
||||||
|
wxMacNetEventsTop++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
|
|
||||||
extern char wxPanelClassName[];
|
extern char wxPanelClassName[];
|
||||||
@ -1439,8 +1559,8 @@ LRESULT APIENTRY _EXPORT wxSocketHandlerWndProc(HWND hWnd, UINT message,
|
|||||||
{
|
{
|
||||||
if(message==WM_DESTROY)
|
if(message==WM_DESTROY)
|
||||||
{
|
{
|
||||||
::SetWindowLong(hWnd, GWL_WNDPROC, (LONG) DefWindowProc);
|
::SetWindowLong(hWnd, GWL_WNDPROC, (LONG) DefWindowProc);
|
||||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
wxSocketHandler *h_sock = (wxSocketHandler *)GetWindowLong(hWnd, GWL_USERDATA);
|
wxSocketHandler *h_sock = (wxSocketHandler *)GetWindowLong(hWnd, GWL_USERDATA);
|
||||||
wxNode *node = h_sock->smsg_list->Find(message);
|
wxNode *node = h_sock->smsg_list->Find(message);
|
||||||
@ -1491,8 +1611,8 @@ wxSocketHandler::wxSocketHandler()
|
|||||||
}
|
}
|
||||||
internal = new wxSockHandlerInternal;
|
internal = new wxSockHandlerInternal;
|
||||||
internal->sockWin = ::CreateWindow(wxPanelClassName, NULL, 0,
|
internal->sockWin = ::CreateWindow(wxPanelClassName, NULL, 0,
|
||||||
0, 0, 0, 0, NULL, (HMENU) NULL,
|
0, 0, 0, 0, NULL, (HMENU) NULL,
|
||||||
wxhInstance, 0);
|
wxhInstance, 0);
|
||||||
|
|
||||||
// Subclass the window
|
// Subclass the window
|
||||||
if (!wxSocketSubClassProc)
|
if (!wxSocketSubClassProc)
|
||||||
@ -1592,8 +1712,8 @@ unsigned long wxSocketHandler::Count() const
|
|||||||
// --------- wxSocketHandler "big" wait functions ---------------
|
// --------- wxSocketHandler "big" wait functions ---------------
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
void handler_cbk(wxSocketBase& sock,
|
void handler_cbk(wxSocketBase& sock,
|
||||||
wxSocketBase::wxRequestEvent WXUNUSED(flags),
|
wxSocketBase::wxRequestEvent WXUNUSED(flags),
|
||||||
char *cdata)
|
char *cdata)
|
||||||
{
|
{
|
||||||
int *a_wait = (int *)cdata;
|
int *a_wait = (int *)cdata;
|
||||||
|
|
||||||
@ -1662,7 +1782,7 @@ void wxSocketHandler::YieldSock()
|
|||||||
// --------- wxSocketHandler: create and register the socket ----
|
// --------- wxSocketHandler: create and register the socket ----
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
wxSocketServer *wxSocketHandler::CreateServer(wxSockAddress& addr,
|
wxSocketServer *wxSocketHandler::CreateServer(wxSockAddress& addr,
|
||||||
wxSocketBase::wxSockFlags flags)
|
wxSocketBase::wxSockFlags flags)
|
||||||
{
|
{
|
||||||
wxSocketServer *serv = new wxSocketServer(addr, flags);
|
wxSocketServer *serv = new wxSocketServer(addr, flags);
|
||||||
|
|
||||||
@ -1715,5 +1835,26 @@ void wxSocketModule::OnExit()
|
|||||||
wxSocketHandler::master = NULL;
|
wxSocketHandler::master = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
void wxMacProcessSocketEvents() ;
|
||||||
|
void wxMacProcessEvents()
|
||||||
|
{
|
||||||
|
wxMacProcessSocketEvents() ;
|
||||||
|
(*GUSISpin)(SP_MISC, 0) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacProcessSocketEvents()
|
||||||
|
{
|
||||||
|
while ( wxMacNetEventsTop != wxMacNetEventsBottom )
|
||||||
|
{
|
||||||
|
// consume event at wxMacNetEventsBottom
|
||||||
|
wxMacSocketOnRequestProc(wxMacNetEventsReferences[wxMacNetEventsBottom] , wxMacNetEventsEvents[wxMacNetEventsBottom] ) ;
|
||||||
|
wxMacNetEventsBottom++ ;
|
||||||
|
if ( wxMacNetEventsBottom == kwxMacNetEventsMax )
|
||||||
|
wxMacNetEventsBottom = 0 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// __WXSTUBS__
|
// __WXSTUBS__
|
||||||
|
@ -33,7 +33,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#ifndef __WXMAC__
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (!defined(__SC__) && !defined(__SGI__) && !defined(__GNUWIN32__) && !defined(__MWERKS__)) || defined(__MINGW32__)
|
#if (!defined(__SC__) && !defined(__SGI__) && !defined(__GNUWIN32__) && !defined(__MWERKS__)) || defined(__MINGW32__)
|
||||||
#include <sys/timeb.h>
|
#include <sys/timeb.h>
|
||||||
|
@ -72,6 +72,36 @@
|
|||||||
|
|
||||||
extern char *wxBuffer;
|
extern char *wxBuffer;
|
||||||
|
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
int strcasecmp(const char *str_1, const char *str_2)
|
||||||
|
{
|
||||||
|
register char c1, c2;
|
||||||
|
do {
|
||||||
|
c1 = tolower(*str_1++);
|
||||||
|
c2 = tolower(*str_2++);
|
||||||
|
} while ( c1 && (c1 == c2) );
|
||||||
|
|
||||||
|
return c1 - c2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int strncasecmp(const char *str_1, const char *str_2, size_t maxchar)
|
||||||
|
{
|
||||||
|
|
||||||
|
register char c1, c2;
|
||||||
|
while( maxchar--)
|
||||||
|
{
|
||||||
|
c1 = tolower(*str_1++);
|
||||||
|
c2 = tolower(*str_2++);
|
||||||
|
|
||||||
|
if ( !c1 || c1!=c2 )
|
||||||
|
return c1 - c2;
|
||||||
|
|
||||||
|
} ;
|
||||||
|
|
||||||
|
return 0 ;
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#ifdef __VMS__
|
#ifdef __VMS__
|
||||||
// we have no strI functions under VMS, therefore I have implemented
|
// we have no strI functions under VMS, therefore I have implemented
|
||||||
// an inefficient but portable version: convert copies of strings to lowercase
|
// an inefficient but portable version: convert copies of strings to lowercase
|
||||||
|
@ -40,7 +40,9 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#ifndef __MWERKS__
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "wx/msw/dib.h"
|
#include "wx/msw/dib.h"
|
||||||
|
|
||||||
|
@ -32,7 +32,9 @@
|
|||||||
#include <wx/msw/dibutils.h>
|
#include <wx/msw/dibutils.h>
|
||||||
|
|
||||||
#if defined(__WIN32__)
|
#if defined(__WIN32__)
|
||||||
|
#ifndef __MWERKS__
|
||||||
#include <memory.h> // for _fmemcpy()
|
#include <memory.h> // for _fmemcpy()
|
||||||
|
#endif
|
||||||
#define _huge
|
#define _huge
|
||||||
#ifndef hmemcpy
|
#ifndef hmemcpy
|
||||||
#define hmemcpy memcpy
|
#define hmemcpy memcpy
|
||||||
|
@ -88,7 +88,7 @@ wxMiniFrame::~wxMiniFrame(void)
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef __WATCOMC__
|
#if !defined( __WATCOMC__ ) && !defined( __MWERKS__ )
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -30,7 +30,9 @@
|
|||||||
#include "malloc.h"
|
#include "malloc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __MWERKS__
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "wx/tbarmsw.h"
|
#include "wx/tbarmsw.h"
|
||||||
|
@ -45,7 +45,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#ifndef __MWERKS__
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#else
|
||||||
|
#include <stat.h>
|
||||||
|
#endif
|
||||||
#if defined(__BORLANDC__) && !defined(__WIN32__)
|
#if defined(__BORLANDC__) && !defined(__WIN32__)
|
||||||
#include <alloc.h>
|
#include <alloc.h>
|
||||||
#else
|
#else
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#if !defined(__SC__) && !defined(__GNUWIN32__)
|
#if !defined(__SC__) && !defined(__GNUWIN32__) && !defined(__MWERKS__)
|
||||||
#include <sys/timeb.h>
|
#include <sys/timeb.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -36,7 +36,9 @@
|
|||||||
|
|
||||||
#ifndef __GNUWIN32__
|
#ifndef __GNUWIN32__
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
|
#ifndef __MWERKS__
|
||||||
#include <dos.h>
|
#include <dos.h>
|
||||||
|
#endif
|
||||||
#endif //GNUWIN32
|
#endif //GNUWIN32
|
||||||
|
|
||||||
#ifdef __GNUWIN32__
|
#ifdef __GNUWIN32__
|
||||||
@ -979,7 +981,9 @@ To download dbwin32, see e.g.:
|
|||||||
http://ftp.digital.com/pub/micro/NT/WinSite/programr/dbwin32.zip
|
http://ftp.digital.com/pub/micro/NT/WinSite/programr/dbwin32.zip
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __MWERKS__
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void OutputDebugStringW95(const char* lpOutputString, ...)
|
void OutputDebugStringW95(const char* lpOutputString, ...)
|
||||||
{
|
{
|
||||||
@ -1056,7 +1060,7 @@ void OutputDebugStringW95(const char* lpOutputString, ...)
|
|||||||
WaitForSingleObject(heventDBWIN, INFINITE);
|
WaitForSingleObject(heventDBWIN, INFINITE);
|
||||||
|
|
||||||
/* write it to the shared memory */
|
/* write it to the shared memory */
|
||||||
#ifdef __BORLANDC__
|
#if defined( __BORLANDC__ ) || defined( __MWERKS__ )
|
||||||
*((LPDWORD)lpszSharedMem) = getpid();
|
*((LPDWORD)lpszSharedMem) = getpid();
|
||||||
#else
|
#else
|
||||||
*((LPDWORD)lpszSharedMem) = _getpid();
|
*((LPDWORD)lpszSharedMem) = _getpid();
|
||||||
|
@ -34,8 +34,10 @@
|
|||||||
|
|
||||||
#ifndef __GNUWIN32__
|
#ifndef __GNUWIN32__
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
|
#ifndef __MWERKS__
|
||||||
#include <dos.h>
|
#include <dos.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUWIN32__
|
#ifdef __GNUWIN32__
|
||||||
#include <sys/unistd.h>
|
#include <sys/unistd.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user