From 15ecd02faa7a8dc1c1674256fbcbbbf6585aa9d5 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sat, 24 Aug 2002 23:29:03 +0000
Subject: [PATCH] Added Watcom C/C++ support.

---
 src/xpdev/dirwrap.h |  8 ++++++--
 src/xpdev/genwrap.c |  2 +-
 src/xpdev/genwrap.h | 11 ++++++++++-
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/xpdev/dirwrap.h b/src/xpdev/dirwrap.h
index f903ac8d61..e93d10b7e9 100644
--- a/src/xpdev/dirwrap.h
+++ b/src/xpdev/dirwrap.h
@@ -65,8 +65,12 @@ extern "C" {
 #else	
 
 	#define ALLFILES "*.*"	/* matches all files in a directory */
-	#define MKDIR(dir)		_mkdir(dir)
-	#define FULLPATH(a,r,l)	_fullpath(a,r,l)
+	#ifdef __WATCOMC__
+		#define MKDIR(dir)		mkdir(dir)
+	#else
+		#define MKDIR(dir)		_mkdir(dir)
+	#endif
+	#define FULLPATH(a,r,l)		_fullpath(a,r,l)
 
 	/* glob-compatible findfirst/findnext wrapper */
 
diff --git a/src/xpdev/genwrap.c b/src/xpdev/genwrap.c
index 18e0f72e9d..c0bfc63696 100644
--- a/src/xpdev/genwrap.c
+++ b/src/xpdev/genwrap.c
@@ -155,7 +155,7 @@ int DLLCALL xp_random(int n)
 /* Return ASCII string representation of ulong								*/
 /* There may be a native GNU C Library function to this...					*/
 /****************************************************************************/
-#if !defined _MSC_VER && !defined __BORLANDC__
+#if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__WATCOMC__)
 char* DLLCALL ultoa(ulong val, char* str, int radix)
 {
 	switch(radix) {
diff --git a/src/xpdev/genwrap.h b/src/xpdev/genwrap.h
index 991e022150..52e5098c3f 100644
--- a/src/xpdev/genwrap.h
+++ b/src/xpdev/genwrap.h
@@ -69,6 +69,11 @@ extern "C" {
 	#define DESCRIBE_COMPILER(str) sprintf(str,"GCC %u.%02u" \
 		,__GNUC__,__GNUC_MINOR__);
 
+#elif defined(__WATCOMC__)
+
+	#define DESCRIBE_COMPILER(str) sprintf(str,"WATC %d" \
+		,__WATCOMC__);
+
 #else /* Unknown compiler */
 
 	#define DESCRIBE_COMPILER(str) strcpy(str,"UNKNOWN COMPILER");
@@ -109,7 +114,11 @@ extern "C" {
 	#define vsnprintf		_vsnprintf
 #endif
 
-#if !defined(_MSC_VER) && !defined(__BORLANDC__)
+#if defined(__WATCOMC__)
+	#define vsnprintf(s,l,f,a)	vsprintf(s,f,a)
+#endif
+
+#if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__WATCOMC__)
 	DLLEXPORT char* DLLCALL ultoa(ulong, char*, int radix);
 #endif
 
-- 
GitLab