#include "wx/list.h"
#include "wx/arrstr.h"
+#ifndef __WXPALMOS5__
#ifdef __WXWINCE__
#include "wx/msw/wince/time.h"
#include "wx/msw/private.h"
#include <unix.h>
#endif
#endif
+#endif // !__WXPALMOS5__
#ifdef __OS2__
// need to check for __OS2__ first since currently both
#endif
#if defined(__WINDOWS__) && !defined(__WXMICROWIN__)
-#if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__) && !defined(__WXWINCE__) && !defined(__CYGWIN__)
+#if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__WXWINCE__) && !defined(__CYGWIN__)
#include <direct.h>
#include <dos.h>
#include <io.h>
#include <dir.h>
#endif
-#ifdef __SALFORDC__
- #include <dir.h>
- #include <unix.h>
-#endif
-
+#ifndef __WXPALMOS5__
#ifndef __WXWINCE__
#include <fcntl.h> // O_RDONLY &c
#endif
+#endif // !__WXPALMOS5__
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
typedef long off_t;
#elif defined(__MWERKS__) && !defined(__INTEL__) && !defined(__MACH__)
typedef long off_t;
+#elif defined(__WXPALMOS5__)
+ typedef long off_t;
#endif
enum wxSeekMode
#define wxCRT_RmDir _wrmdir
#define wxCRT_Stat _wstat
#define wxStructStat struct _stat
-#elif defined(__WXMSW__) && !defined(__WXPALMOS__) && \
+#elif (defined(__WXMSW__) || defined(__OS2__)) && !defined(__WXPALMOS__) && \
( \
defined(__VISUALC__) || \
(defined(__MINGW32__) && !defined(__WINE__) && \
#endif // wxHAS_HUGE_FILES/!wxHAS_HUGE_FILES
#ifndef __WATCOMC__
- #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x540)
- // NB: this one is not POSIX and always has the underscore
- #define wxFsync _commit
-
- #define HAVE_FSYNC
- #endif // BORLANDC
+ #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x540)
+ // NB: this one is not POSIX and always has the underscore
+ #define wxFsync _commit
+
+ // could be already defined by configure (Cygwin)
+ #ifndef HAVE_FSYNC
+ #define HAVE_FSYNC
+ #endif
+ #endif // BORLANDC
#endif
#define wxEof wxPOSIX_IDENT(eof)
#ifdef wxHAS_HUGE_FILES
#define wxCRT_Stat wxPOSIX_IDENT(stati64)
#else
- #define wxCRT_Stat wxPOSIX_IDENT(stat)
+ // Unfortunately Watcom is not consistent, so:-
+ #if defined(__OS2__) && defined(__WATCOMC__)
+ #define wxCRT_Stat _stat
+ #else
+ #define wxCRT_Stat wxPOSIX_IDENT(stat)
+ #endif
#endif
#endif // wxUSE_UNICODE/!wxUSE_UNICODE
// it's a private define, undefine it so that nobody gets tempted to use it
#undef wxHAS_HUGE_FILES
+#elif defined (__WXPALMOS__)
+ typedef off_t wxFileOffset;
+#ifdef _LARGE_FILES
+ #define wxFileOffsetFmtSpec wxLongLongFmtSpec
+ wxCOMPILE_TIME_ASSERT( sizeof(off_t) == sizeof(wxLongLong_t), BadFileSizeType );
+ // wxFile is present and supports large files
+ #ifdef wxUSE_FILE
+ #define wxHAS_LARGE_FILES
+ #endif
+ // wxFFile is present and supports large files
+ #if SIZEOF_LONG == 8 || defined HAVE_FSEEKO
+ #define wxHAS_LARGE_FFILES
+ #endif
+#else
+ #define wxFileOffsetFmtSpec _T("")
+#endif
+ #define wxClose close
+ #define wxRead ::read
+ #define wxWrite ::write
+ #define wxLseek lseek
+ #define wxSeek lseek
+ #define wxFsync fsync
+ #define wxEof eof
+
+ #define wxCRT_MkDir mkdir
+ #define wxCRT_RmDir rmdir
+
+ #define wxTell(fd) lseek(fd, 0, SEEK_CUR)
+
+ #define wxStructStat struct stat
+
+ #define wxCRT_Open open
+ #define wxCRT_Stat svfs_stat
+ #define wxCRT_Lstat lstat
+ #define wxCRT_Access access
+
+ #define wxHAS_NATIVE_LSTAT
#else // Unix or Windows using unknown compiler, assume POSIX supported
typedef off_t wxFileOffset;
#ifdef _LARGE_FILES
#define wxCRT_Lstat wxCRT_Stat
#endif
-inline int wxStat(const wxString& path, wxStructStat *buf)
- { return wxCRT_Stat(path.fn_str(), buf); }
-inline int wxLstat(const wxString& path, wxStructStat *buf)
- { return wxCRT_Lstat(path.fn_str(), buf); }
inline int wxAccess(const wxString& path, mode_t mode)
{ return wxCRT_Access(path.fn_str(), mode); }
inline int wxOpen(const wxString& path, int flags, mode_t mode)
{ return wxCRT_Open(path.fn_str(), flags, mode); }
+
+// FIXME-CE: provide our own implementations of the missing CRT functions
+#ifndef __WXWINCE__
+inline int wxStat(const wxString& path, wxStructStat *buf)
+ { return wxCRT_Stat(path.fn_str(), buf); }
+inline int wxLstat(const wxString& path, wxStructStat *buf)
+ { return wxCRT_Lstat(path.fn_str(), buf); }
inline int wxRmDir(const wxString& path)
{ return wxCRT_RmDir(path.fn_str()); }
-#ifdef __WINDOWS__
+#if defined(__WINDOWS__) || (defined(__OS2__) && defined(__WATCOMC__))
inline int wxMkDir(const wxString& path, mode_t WXUNUSED(mode) = 0)
{ return wxCRT_MkDir(path.fn_str()); }
#else
inline int wxMkDir(const wxString& path, mode_t mode)
{ return wxCRT_MkDir(path.fn_str(), mode); }
#endif
+#endif // !__WXWINCE__
#ifdef O_BINARY
#define wxO_BINARY O_BINARY
// CYGWIN also uses UNIX settings
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX
#define wxPATH_SEP wxPATH_SEP_UNIX
+#elif defined(__WXPALMOS__)
+ #define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX
+ #define wxPATH_SEP wxPATH_SEP_UNIX
#elif defined(__MAC__)
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_MAC
#define wxPATH_SEP wxPATH_SEP_MAC