protected:
static bool IsImmutable(const wxString& key)
+ #ifndef __WXMAC__
{ return !key.IsEmpty() && key[0u] == wxCONFIG_IMMUTABLE_PREFIX; }
+ #else
+ { return !key.IsEmpty() && key[0ul] == wxCONFIG_IMMUTABLE_PREFIX; }
+ #endif
private:
// are we doing automatic environment variable expansion?
#undef except
#undef finally
#define except(x) catch(...)
+#elif defined(__MWERKS__)
+#undef try
+#undef except
+#undef finally
+#define except(x) catch(...)
#endif
// where should i put this? we need to make sure of this as it breaks
// ----------------------------------------------------------------------------
// define off_t
+#ifndef __WXMAC__
#include <sys/types.h>
+#else
+typedef long off_t;
+#endif
#ifdef _MSC_VER
#define off_t _off_t
WXDLLEXPORT void wxUnix2DosFilename(char *s);
#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
WXDLLEXPORT void wxStripExtension(char *buffer);
WXDLLEXPORT void wxStripExtension(wxString& buffer);
DECLARE_EVENT_TABLE()
};
-#ifndef __WXMSW__
+#if !defined( __WXMSW__ ) && !defined( __WXMAC__)
#define wxMessageDialog wxGenericMessageDialog
int wxMessageBox(const wxString& message, const wxString& caption = wxMessageBoxCaptionStr,
#elif defined(__WXQT__)
#include "wx/generic/msgdlgg.h"
#elif defined(__WXMAC__)
-#include "wx/generic/msgdlgg.h"
+#include "wx/mac/msgdlg.h"
#elif defined(__WXSTUBS__)
#include "wx/generic/msgdlgg.h"
#endif
class WXDLLEXPORT wxSocketBase : public wxEvtHandler
{
DECLARE_CLASS(wxSocketBase)
+#ifdef __WXMAC__
+friend void wxMacSocketOnRequestProc(void *refcon , short event) ;
+#endif
public:
enum wxSockFlags { NONE=0, NOWAIT=1, WAITALL=2, SPEED=4 };
typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&);
+#define wxEVT_SOCKET wxEVT_FIRST+301
+
#define EVT_SOCKET(id, func) { wxEVT_SOCKET, id, 0, \
(wxObjectEventFunction) (wxEventFunction) (wxSocketEventFunction) & func, \
(wxObject *) NULL },
* stdarg.h
* limits.h
*/
+#ifdef __WXMAC__
+#include <ctype.h>
+#endif
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
return stricmp(psz1, psz2);
#elif defined(__UNIX__) || defined(__GNUWIN32__)
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
// almost all compilers/libraries provide this function (unfortunately under
// different names), that's why we don't implement our own which will surely
#elif defined(__WXGTK__)
#elif defined(__WXQT__)
#elif defined(__WXMAC__)
+#include "wx/mac/taskbar.h"
#elif defined(__WXSTUBS__)
#include "wx/stubs/taskbar.h"
#endif
#ifndef _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>
-#elif __BEOS__
- #include <ansi_prefix.be.h>
- #include <Be.h>
-#else
- #error unknown MW compiler
+#ifdef __cplusplus
+ #if __POWERPC__
+ #include <wx_PPC++.mch>
+ #elif __INTEL__
+ #include <wx_x86++.mch>
+ #elif __CFM68K__
+ #include <wx_cfm++.mch>
+ #else
+ #include <wx_68k++.mch>
+ #endif
+#else
+ #if __POWERPC__
+ #include <wx_PPC.mch>
+ #elif __INTEL__
+ #include <wx_x86.mch>
+ #elif __CFM68K__
+ #include <wx_cfm.mch>
+ #else
+ #include <wx_68k.mch>
+ #endif
#endif
-// in order to avoid problems further down in wxWindows
-
-char *strdup(const char *s) ;
-
#endif
// _WX_CW__
#ifndef _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
-extern "C"
-{
-#endif
- char *strdup(const char *s) ;
- int isascii( int c ) ;
#ifdef __cplusplus
-} ;
+ #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
+#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
// _WX_CW__
{
#if defined(__UNIX__)
return dlsym(m_handle, WXSTRINGCAST symbname);
-#endif
-#ifdef __WINDOWS__
+#elif defined( __WINDOWS__ )
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
return NULL;
}
#endif
if (!handle)
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
return NULL;
#endif
#elif (defined(__WXSTUBS__))
// Have to ifdef this for different environments
#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
#error "Please specify the header with file functions declarations."
#endif //Win/UNIX
// otherwise rename() in Commit() might not work (if the files are on
// different partitions for example). Unfortunately, the only standard
// (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";
m_strTemp << strName << szMktempSuffix;
mktemp((char *)m_strTemp.c_str()); // will do because length doesn't change
strDir = "/etc/";
#elif defined(__WXSTUBS__)
wxASSERT_MSG( FALSE, "TODO" ) ;
+ #elif defined(__WXMAC__)
+ wxASSERT_MSG( FALSE, "TODO" ) ;
#else // Windows
char szWinDir[MAX_PATH];
::GetWindowsDirectory(szWinDir, MAX_PATH);
#define _MAXPATHLEN 500
extern char *wxBuffer;
+#ifdef __WXMAC__
+extern char gwxMacFileName[] ;
+extern char gwxMacFileName2[] ;
+extern char gwxMacFileName3[] ;
+#endif
#if !USE_SHARED_LIBRARIES
IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxStringList)
{
wxString path2((char *) node->Data ());
if (
-#if defined(__WINDOWS__) || defined(__VMS__)
+#if defined(__WINDOWS__) || defined(__VMS__) || defined (__WXMAC__)
// Case INDEPENDENT
path.CompareTo (path2, wxString::ignoreCase) == 0
#else
return FALSE;
else
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
struct stat stbuf;
// and back again - or we get nasty problems with delimiters.
// 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
wxDos2UnixFilename (char *s)
{
FILE *fp2 = (FILE *) NULL;
FILE *fp3 = (FILE *) NULL;
// 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 ||
(fp2 = fopen (WXSTRINGCAST file2, "rb")) == NULL ||
(fp3 = fopen (outfile, "wb")) == NULL)
+#endif
{
if (fp1)
fclose (fp1);
FILE *fd2;
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)
return FALSE;
if ((fd2 = fopen (WXSTRINGCAST file2, "wb")) == NULL)
+#endif
{
fclose (fd1);
return FALSE;
bool
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
if (0 == rename (WXSTRINGCAST file1, WXSTRINGCAST file2))
return TRUE;
+#endif
// Try to copy
if (wxCopyFile(file1, file2)) {
wxRemoveFile(file1);
{
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
int flag = remove(WXSTRINGCAST file);
+#elif defined( __WXMAC__ )
+ strcpy( gwxMacFileName , file ) ;
+ wxUnix2MacFilename( gwxMacFileName ) ;
+ int flag = unlink(gwxMacFileName);
#else
int flag = unlink(WXSTRINGCAST file);
#endif
return FALSE;
#elif defined(__VMS__)
return FALSE;
+#elif defined( __WXMAC__ )
+ strcpy( gwxMacFileName , dir ) ;
+ wxUnix2MacFilename( gwxMacFileName ) ;
+ return (mkdir(gwxMacFileName , 0 ) == 0);
#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);
#else
{
#ifdef __VMS__
return FALSE;
+#elif defined( __WXMAC__ )
+ strcpy( gwxMacFileName , dir ) ;
+ wxUnix2MacFilename( gwxMacFileName ) ;
+ return (rmdir(WXSTRINGCAST gwxMacFileName) == 0);
#else
return (rmdir(WXSTRINGCAST dir) == 0);
#endif
bool wxSetWorkingDirectory(const wxString& d)
{
-#ifdef __UNIX__
+#if defined( __UNIX__ ) || defined( __WXMAC__ )
return (chdir(d) == 0);
#elif defined(__WINDOWS__)
#ifndef __MWERKS__
#include <memory.h>
#endif
+#if defined(__WXMAC__)
+#include "/wx/mac/macsock.h"
+#endif
+
#include <stdlib.h>
#include "wx/string.h"
#include "wx/utils.h"
DebugBreak();
#elif defined(__WXSTUBS__)
// TODO
+ #elif defined(__WXMAC__)
+ #if __powerc
+ Debugger();
+ #else
+ SysBreak();
+ #endif
#else // Unix
raise(SIGTRAP);
#endif // Win/Unix
#include "wx/defs.h"
#include "wx/object.h"
+#if defined(__WXMAC__)
+#include "/wx/mac/macsock.h"
+#endif
+
#if defined(__WINDOWS__)
#include <winsock.h>
#endif // __WINDOWS__
return FALSE;
}
} else {
+#ifdef __WXMAC__
+ long len_addr = inet_addr(name.GetData()).s_addr ;
+#else
long len_addr = inet_addr(name.GetData());
+#endif
if (len_addr == -1)
return FALSE;
m_addr->sin_addr.s_addr = len_addr;
// #pragma implementation "socket.cpp"
#endif
+#ifdef __MWERKS__
+typedef int socklen_t ;
+#endif
+
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
/////////////////////////////////////////////////////////////////////////////
// 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__)
#include <winsock.h>
#endif // __WINDOWS__
#if defined( NEED_WSAFDIsSet ) || defined( _MSC_VER )
int PASCAL FAR __WSAFDIsSet(SOCKET fd, fd_set FAR *set)
{
- int i = set->fd_count;
+ int i = set->fd_count;
- while (i--)
- {
- if (set->fd_array[i] == fd)
- return 1;
- }
+ while (i--)
+ {
+ if (set->fd_array[i] == fd)
+ return 1;
+ }
- return 0;
+ return 0;
}
#endif
#endif
// --------- wxSocketBase CONSTRUCTOR ---------------------------
// --------------------------------------------------------------
wxSocketBase::wxSocketBase(wxSocketBase::wxSockFlags _flags,
- wxSocketBase::wxSockType _type) :
+ wxSocketBase::wxSockType _type) :
wxEvtHandler(),
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),
#if defined(__WXMOTIF__) || defined(__WXXT__) || defined(__WXGTK__)
#if defined(__WXMOTIF__) || defined(__WXXT__)
static void wx_socket_read(XtPointer client, int *fid,
- XtInputId *WXUNUSED(id))
+ XtInputId *WXUNUSED(id))
#define fd *fid
#else
static void wx_socket_read(gpointer client, gint fd,
#if defined(__WXMOTIF__) || defined(__WXXT__)
static void wx_socket_write(XtPointer client, int *WXUNUSED(fid),
- XtInputId *WXUNUSED(id))
+ XtInputId *WXUNUSED(id))
#else
static void wx_socket_write(gpointer client, gint WXUNUSED(fd),
- GdkInputCondition WXUNUSED(cond))
+ GdkInputCondition WXUNUSED(cond))
#endif
{
wxSocketBase *sock = (wxSocketBase *)client;
if (m_fd == INVALID_SOCKET || !m_handler || (m_flags & SPEED))
return;
-
#if defined(__WXMOTIF__) || defined(__WXXT__)
if (m_neededreq & (REQ_ACCEPT | REQ_READ | REQ_LOST))
{
if (!m_internal->my_msg)
m_internal->my_msg = m_handler->NewMessage(this);
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
m_cbkon = TRUE;
m_processing = FALSE;
#ifdef __WINDOWS__
WSAAsyncSelect(m_fd, m_handler->GetHWND(), 0, 0);
#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::WantBuffer(char *buffer, size_t nbytes,
- wxRequestEvent evt)
+ wxRequestEvent evt)
{
bool buf_timed_out;
// --------------------------------------------------------------
wxSocketServer::wxSocketServer(wxSockAddress& addr_man,
- wxSockFlags flags) :
+ wxSockFlags flags) :
wxSocketBase(flags, SOCK_SERVER)
{
m_fd = socket(addr_man.GetFamily(), SOCK_STREAM, 0);
// --------- wxSocketClient CONSTRUCTOR -------------------------
// --------------------------------------------------------------
wxSocketClient::wxSocketClient(wxSockFlags _flags) :
- wxSocketBase(_flags, SOCK_CLIENT)
+ wxSocketBase(_flags, SOCK_CLIENT)
{
}
// --------------------------------------------------------------
// --------- 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__
extern char wxPanelClassName[];
{
if(message==WM_DESTROY)
{
- ::SetWindowLong(hWnd, GWL_WNDPROC, (LONG) DefWindowProc);
- return DefWindowProc(hWnd, message, wParam, lParam);
+ ::SetWindowLong(hWnd, GWL_WNDPROC, (LONG) DefWindowProc);
+ return DefWindowProc(hWnd, message, wParam, lParam);
}
wxSocketHandler *h_sock = (wxSocketHandler *)GetWindowLong(hWnd, GWL_USERDATA);
wxNode *node = h_sock->smsg_list->Find(message);
}
internal = new wxSockHandlerInternal;
internal->sockWin = ::CreateWindow(wxPanelClassName, NULL, 0,
- 0, 0, 0, 0, NULL, (HMENU) NULL,
- wxhInstance, 0);
+ 0, 0, 0, 0, NULL, (HMENU) NULL,
+ wxhInstance, 0);
// Subclass the window
if (!wxSocketSubClassProc)
// --------- wxSocketHandler "big" wait functions ---------------
// --------------------------------------------------------------
void handler_cbk(wxSocketBase& sock,
- wxSocketBase::wxRequestEvent WXUNUSED(flags),
- char *cdata)
+ wxSocketBase::wxRequestEvent WXUNUSED(flags),
+ char *cdata)
{
int *a_wait = (int *)cdata;
// --------- wxSocketHandler: create and register the socket ----
// --------------------------------------------------------------
wxSocketServer *wxSocketHandler::CreateServer(wxSockAddress& addr,
- wxSocketBase::wxSockFlags flags)
+ wxSocketBase::wxSockFlags flags)
{
wxSocketServer *serv = new wxSocketServer(addr, flags);
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
// __WXSTUBS__
#endif
#include <time.h>
+#ifndef __WXMAC__
#include <sys/types.h>
+#endif
#if (!defined(__SC__) && !defined(__SGI__) && !defined(__GNUWIN32__) && !defined(__MWERKS__)) || defined(__MINGW32__)
#include <sys/timeb.h>
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__
// we have no strI functions under VMS, therefore I have implemented
// an inefficient but portable version: convert copies of strings to lowercase
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
+#ifndef __MWERKS__
#include <memory.h>
+#endif
#include "wx/msw/dib.h"
#include <wx/msw/dibutils.h>
#if defined(__WIN32__)
+#ifndef __MWERKS__
#include <memory.h> // for _fmemcpy()
+#endif
#define _huge
#ifndef hmemcpy
#define hmemcpy memcpy
#include <string.h>
-#ifndef __WATCOMC__
+#if !defined( __WATCOMC__ ) && !defined( __MWERKS__ )
#include <memory.h>
#endif
#include "malloc.h"
#endif
+#ifndef __MWERKS__
#include <memory.h>
+#endif
#include <stdlib.h>
#include "wx/tbarmsw.h"
#endif
#include <sys/types.h>
+#ifndef __MWERKS__
#include <sys/stat.h>
+#else
+#include <stat.h>
+#endif
#if defined(__BORLANDC__) && !defined(__WIN32__)
#include <alloc.h>
#else
#include <time.h>
#include <sys/types.h>
-#if !defined(__SC__) && !defined(__GNUWIN32__)
+#if !defined(__SC__) && !defined(__GNUWIN32__) && !defined(__MWERKS__)
#include <sys/timeb.h>
#endif
#ifndef __GNUWIN32__
#include <direct.h>
+#ifndef __MWERKS__
#include <dos.h>
+#endif
#endif //GNUWIN32
#ifdef __GNUWIN32__
http://ftp.digital.com/pub/micro/NT/WinSite/programr/dbwin32.zip
*/
+#ifndef __MWERKS__
#include <process.h>
+#endif
void OutputDebugStringW95(const char* lpOutputString, ...)
{
WaitForSingleObject(heventDBWIN, INFINITE);
/* write it to the shared memory */
-#ifdef __BORLANDC__
+#if defined( __BORLANDC__ ) || defined( __MWERKS__ )
*((LPDWORD)lpszSharedMem) = getpid();
#else
*((LPDWORD)lpszSharedMem) = _getpid();
#ifndef __GNUWIN32__
#include <direct.h>
+#ifndef __MWERKS__
#include <dos.h>
#endif
+#endif
#ifdef __GNUWIN32__
#include <sys/unistd.h>