summaryrefslogtreecommitdiff
path: root/lib/win32/emu.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/win32/emu.h')
-rw-r--r--lib/win32/emu.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/lib/win32/emu.h b/lib/win32/emu.h
index f3389590..bc91e2ba 100644
--- a/lib/win32/emu.h
+++ b/lib/win32/emu.h
@@ -1,5 +1,10 @@
// emulates unix syscalls to win32 functions
+<<<<<<< HEAD
+=======
+#include "emu_winver.h"
+
+>>>>>>> 0.12
#ifdef WIN32
#define EMU_STRUCT_STAT struct emu_stat
#define EMU_STAT emu_stat
@@ -15,6 +20,17 @@
#if ! defined EMU_INCLUDE && defined WIN32
#define EMU_INCLUDE
+<<<<<<< HEAD
+=======
+// Need feature detection macros below
+#include "../common/BoxConfig.h"
+
+// Shut up stupid new warnings. Thanks MinGW! Ever heard of "compatibility"?
+#ifdef __MINGW32__
+# define __MINGW_FEATURES__ 0
+#endif
+
+>>>>>>> 0.12
// basic types, may be required by other headers since we
// don't include sys/types.h
@@ -42,6 +58,7 @@
typedef unsigned int pid_t;
#endif
+<<<<<<< HEAD
// set up to include the necessary parts of Windows headers
#define WIN32_LEAN_AND_MEAN
@@ -50,6 +67,8 @@
#define __MSVCRT_VERSION__ 0x0601
#endif
+=======
+>>>>>>> 0.12
// Windows headers
#include <winsock2.h>
@@ -220,17 +239,28 @@ inline int strcasecmp(const char *s1, const char *s2)
struct dirent
{
char *d_name;
+<<<<<<< HEAD
unsigned long d_type;
+=======
+ DWORD d_type; // file attributes
+>>>>>>> 0.12
};
struct DIR
{
+<<<<<<< HEAD
intptr_t fd; // filedescriptor
// struct _finddata_t info;
struct _wfinddata_t info;
// struct _finddata_t info;
struct dirent result; // d_name (first time null)
wchar_t *name; // null-terminated byte string
+=======
+ HANDLE fd; // the HANDLE returned by FindFirstFile
+ WIN32_FIND_DATAW info;
+ struct dirent result; // d_name (first time null)
+ wchar_t* name; // null-terminated byte string
+>>>>>>> 0.12
};
DIR *opendir(const char *name);
@@ -286,9 +316,24 @@ inline unsigned int sleep(unsigned int secs)
}
#define INFTIM -1
+<<<<<<< HEAD
#define POLLIN 0x1
#define POLLERR 0x8
#define POLLOUT 0x4
+=======
+
+#ifndef POLLIN
+# define POLLIN 0x1
+#endif
+
+#ifndef POLLERR
+# define POLLERR 0x8
+#endif
+
+#ifndef POLLOUT
+# define POLLOUT 0x4
+#endif
+>>>>>>> 0.12
#define SHUT_RDWR SD_BOTH
#define SHUT_RD SD_RECEIVE
@@ -307,11 +352,14 @@ inline int ioctl(SOCKET sock, int flag, int * something)
return 0;
}
+<<<<<<< HEAD
extern "C" inline int getpid()
{
return (int)GetCurrentProcessId();
}
+=======
+>>>>>>> 0.12
inline int waitpid(pid_t pid, int *status, int)
{
return 0;
@@ -351,12 +399,21 @@ int emu_chmod (const char* pName, mode_t mode);
char* emu_getcwd (char* pBuffer, int BufSize);
int emu_rename (const char* pOldName, const char* pNewName);
+<<<<<<< HEAD
#define chdir(directory) emu_chdir (directory)
#define mkdir(path, mode) emu_mkdir (path)
#define unlink(file) emu_unlink (file)
#define utimes(buffer, times) emu_utimes (buffer, times)
#define chmod(file, mode) emu_chmod (file, mode)
#define getcwd(buffer, size) emu_getcwd (buffer, size)
+=======
+#define chdir(directory) emu_chdir (directory)
+#define mkdir(path, mode) emu_mkdir (path)
+#define unlink(file) emu_unlink (file)
+#define utimes(buffer, times) emu_utimes (buffer, times)
+#define chmod(file, mode) emu_chmod (file, mode)
+#define getcwd(buffer, size) emu_getcwd (buffer, size)
+>>>>>>> 0.12
#define rename(oldname, newname) emu_rename (oldname, newname)
// Not safe to replace stat/fstat/lstat on mingw at least, as struct stat
@@ -396,6 +453,13 @@ bool ConvertFromUtf8 (const std::string& rSource, std::string& rDest,
int destCodePage);
bool ConvertUtf8ToConsole(const std::string& rSource, std::string& rDest);
bool ConvertConsoleToUtf8(const std::string& rSource, std::string& rDest);
+<<<<<<< HEAD
+=======
+char* ConvertFromWideString(const WCHAR* pString, unsigned int codepage);
+bool ConvertFromWideString(const std::wstring& rInput,
+ std::string* pOutput, unsigned int codepage);
+std::string ConvertPathToAbsoluteUnicode(const char *pFileName);
+>>>>>>> 0.12
// Utility function which returns a default config file name,
// based on the path of the current executable.
@@ -409,6 +473,21 @@ std::string GetErrorMessage(DWORD errorCode);
// relatively recent C runtime lib
int console_read(char* pBuffer, size_t BufferSize);
+<<<<<<< HEAD
+=======
+// Defined thus by MinGW, but missing from MSVC
+// [http://curl.haxx.se/mail/lib-2004-11/0260.html]
+// note: chsize() doesn't work over 2GB:
+// [https://stat.ethz.ch/pipermail/r-devel/2005-May/033339.html]
+#ifndef HAVE_FTRUNCATE
+ extern "C" int ftruncate(int, off_t);
+ inline int ftruncate(int __fd, off_t __length)
+ {
+ return _chsize(__fd, __length);
+ }
+#endif
+
+>>>>>>> 0.12
#ifdef _MSC_VER
/* disable certain compiler warnings to be able to actually see the show-stopper ones */
#pragma warning(disable:4101) // unreferenced local variable