From 31907d03078c41ac09b2ff36267e980c57410f72 Mon Sep 17 00:00:00 2001
From: Stefan Csomor <csomor@advancedconcepts.ch>
Date: Sat, 29 Mar 2003 15:50:13 +0000
Subject: [PATCH] unicode and __MACH__ additions for wxMac

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/common/cwy_tab.c    | 4 +++-
 src/common/datetime.cpp | 4 ++++
 src/common/file.cpp     | 5 ++++-
 src/common/filefn.cpp   | 7 +++++++
 src/common/filename.cpp | 7 +++++++
 src/common/log.cpp      | 5 +++++
 src/common/utilscmn.cpp | 4 +---
 src/common/variant.cpp  | 4 ++++
 src/common/wxchar.cpp   | 8 ++++----
 9 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/src/common/cwy_tab.c b/src/common/cwy_tab.c
index b83301066b..8cbbcb14c3 100644
--- a/src/common/cwy_tab.c
+++ b/src/common/cwy_tab.c
@@ -29,13 +29,15 @@ int yyback(int *, int);
 #if __MSL__ < 0x6000
 int read( int , char * , int ) ;
 #else
+#ifndef __MACH__
 int _read( int , void * , size_t ) ;
 #define read _read
 #endif
+#endif
 #ifdef __WXMSW__
 //int fileno( FILE* ) ; This is defined in watcom
 #else
-#if __MSL__ < 0x6000
+#if __MSL__ < 0x6000L
 int fileno( void* ) ;
 #endif
 #endif
diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp
index 5ab055b3cc..d796e6e127 100644
--- a/src/common/datetime.cpp
+++ b/src/common/datetime.cpp
@@ -97,6 +97,10 @@
     #undef HAVE_STRPTIME
 #endif // broken strptime()
 
+#if defined(__MWERKS__) && wxUSE_UNICODE
+    #include <wtime.h>
+#endif
+
 #if !defined(WX_TIMEZONE) && !defined(WX_GMTOFF_IN_TM)
     #if defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__)
         #define WX_TIMEZONE _timezone
diff --git a/src/common/file.cpp b/src/common/file.cpp
index 372c692461..04fd887a93 100644
--- a/src/common/file.cpp
+++ b/src/common/file.cpp
@@ -91,7 +91,10 @@
 #include  <stdio.h>       // SEEK_xxx constants
 #include  <fcntl.h>       // O_RDONLY &c
 
-#if !defined(__MWERKS__) || defined(__WXMSW__)
+#ifndef __MWERKS__
+    #include  <sys/types.h>   // needed for stat
+    #include  <sys/stat.h>    // stat
+#elif defined(__MWERKS__) && ( defined(__WXMSW__) || defined(__MACH__) )
     #include  <sys/types.h>   // needed for stat
     #include  <sys/stat.h>    // stat
 #endif
diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp
index 7f54e8896d..d05fb1ecc3 100644
--- a/src/common/filefn.cpp
+++ b/src/common/filefn.cpp
@@ -59,12 +59,19 @@
 #ifndef __MWERKS__
     #include <sys/types.h>
     #include <sys/stat.h>
+#else
+#ifdef __MACH__
+#include <sys/types.h>
+#include <utime.h>
+#include <sys/stat.h>
+#include <unistd.h>
 #else
     #include <stat.h>
     #include <unistd.h>
     #include <unix.h>
     #include <fcntl.h>
 #endif
+#endif
 
 #ifdef __UNIX__
     #include <unistd.h>
diff --git a/src/common/filename.cpp b/src/common/filename.cpp
index 639e5363c3..82efd1a6ae 100644
--- a/src/common/filename.cpp
+++ b/src/common/filename.cpp
@@ -107,10 +107,17 @@
 #endif
 
 #ifdef __MWERKS__
+#ifdef __MACH__
+#include <sys/types.h>
+#include <utime.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#else
 #include <stat.h>
 #include <unistd.h>
 #include <unix.h>
 #endif
+#endif
 
 #ifdef __WATCOMC__
 #include <io.h>
diff --git a/src/common/log.cpp b/src/common/log.cpp
index 9214732ed8..02b83693bf 100644
--- a/src/common/log.cpp
+++ b/src/common/log.cpp
@@ -65,6 +65,11 @@
   #include  "wx/mac/private.h"  // includes mac headers
 #endif
 
+#if defined(__MWERKS__) && wxUSE_UNICODE
+    #include <wtime.h>
+#endif
+
+
 // ----------------------------------------------------------------------------
 // non member functions
 // ----------------------------------------------------------------------------
diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp
index 2ba6e85830..ae8c7e79dc 100644
--- a/src/common/utilscmn.cpp
+++ b/src/common/utilscmn.cpp
@@ -801,13 +801,11 @@ wxFont wxGetFontFromUser(wxWindow *parent, const wxFont& fontInit)
 // missing C RTL functions (FIXME shouldn't be here at all)
 // ----------------------------------------------------------------------------
 
-#ifdef __MWERKS__
-#if __MSL__ < 0x7000
+#if defined( __MWERKS__ ) && !defined(__MACH__)
 char *strdup(const char *s)
 {
         return strcpy( (char*) malloc( strlen( s ) + 1 ) , s ) ;
 }
-#endif
 int isascii( int c )
 {
         return ( c >= 0 && c < 128 ) ;
diff --git a/src/common/variant.cpp b/src/common/variant.cpp
index c6a70f2a33..7994a92651 100644
--- a/src/common/variant.cpp
+++ b/src/common/variant.cpp
@@ -28,6 +28,10 @@
     #endif
 #endif
 
+#if defined(__MWERKS__) && __MSL__ >= 0x6000
+using namespace std ;
+#endif
+
 #if wxUSE_STREAMS
 #include "wx/stream.h"
 #include "wx/txtstrm.h"
diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp
index afff852e81..7e6c8f21f4 100644
--- a/src/common/wxchar.cpp
+++ b/src/common/wxchar.cpp
@@ -47,6 +47,10 @@
   #include <winnt.h>
 #endif
 
+#if defined(__MWERKS__) && __MSL__ >= 0x6000
+using namespace std ;
+#endif
+
 #if wxUSE_WCHAR_T
 size_t WXDLLEXPORT wxMB2WC(wchar_t *buf, const char *psz, size_t n)
 {
@@ -848,11 +852,7 @@ int wxFscanf( FILE *stream, const wxChar *format, ... )
 {
     va_list argptr;
     va_start(argptr, format);
-#ifdef __WXMAC__ 
-    int ret = ::vfwscanf(stream, wxFormatConverter(format), argptr);
-#else
     int ret = vfwscanf(stream, wxFormatConverter(format), argptr);
-#endif
 
     va_end(argptr);
 
-- 
2.47.2