summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-05-14 22:32:33 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-05-14 22:32:33 (GMT)
commit58e0a8c13015627b5cd4abff6563bef02532596c (patch)
tree7734b82cb756f5a4e534678d6b236b6fb51f5ab5
parent460f0691dff8e8f36b325a87f1af25ca6571ddad (diff)
downloadcpython-58e0a8c13015627b5cd4abff6563bef02532596c.zip
cpython-58e0a8c13015627b5cd4abff6563bef02532596c.tar.gz
cpython-58e0a8c13015627b5cd4abff6563bef02532596c.tar.bz2
SF patch #418147 Fixes to allow compiling w/ Borland, from Stephen Hansen.
-rw-r--r--Include/pyport.h9
-rw-r--r--Misc/NEWS4
-rw-r--r--Modules/posixmodule.c18
-rw-r--r--Modules/timemodule.c8
-rw-r--r--PC/config.h7
5 files changed, 32 insertions, 14 deletions
diff --git a/Include/pyport.h b/Include/pyport.h
index 852efb8..2a59fa1 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -434,6 +434,15 @@ typedef struct fd_set {
#endif
#endif
+/*
+ * Rename some functions for the Borland compiler
+ */
+#ifdef __BORLANDC__
+# include <io.h>
+# define _chsize chsize
+# define _setmode setmode
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/Misc/NEWS b/Misc/NEWS
index 2290a10..d69c45f 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -105,6 +105,10 @@ Tests
pprint.isreadable() return sensible results. Also verifies that simple
cases produce correct output.
+New platforms
+
+- Python should compile and run out of the box using the Borland C
+ compiler (under Windows), thanks to Stephen Hansen.
What's New in Python 2.1 (final)?
=================================
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 430a44a..3a85798 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -63,12 +63,6 @@ corresponding Unix manual entries for more information on calls.";
#ifdef __BORLANDC__ /* Borland compiler */
#define HAVE_EXECV 1
#define HAVE_GETCWD 1
-#define HAVE_GETEGID 1
-#define HAVE_GETEUID 1
-#define HAVE_GETGID 1
-#define HAVE_GETPPID 1
-#define HAVE_GETUID 1
-#define HAVE_KILL 1
#define HAVE_OPENDIR 1
#define HAVE_PIPE 1
#define HAVE_POPEN 1
@@ -152,7 +146,11 @@ extern int rmdir(char *);
extern int chdir(const char *);
extern int rmdir(const char *);
#endif
+#ifdef __BORLANDC__
+extern int chmod(const char *, int);
+#else
extern int chmod(const char *, mode_t);
+#endif
extern int chown(const char *, uid_t, gid_t);
extern char *getcwd(char *, int);
extern char *strerror(int);
@@ -5666,18 +5664,18 @@ all_ins(PyObject *d)
}
-#if ( defined(_MSC_VER) || defined(__WATCOMC__) ) && !defined(__QNX__)
+#if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__)
#define INITFUNC initnt
#define MODNAME "nt"
-#else
-#if defined(PYOS_OS2)
+
+#elif defined(PYOS_OS2)
#define INITFUNC initos2
#define MODNAME "os2"
+
#else
#define INITFUNC initposix
#define MODNAME "posix"
#endif
-#endif
DL_EXPORT(void)
INITFUNC(void)
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 0c5c257..0a54a93 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -41,17 +41,19 @@ extern int ftime(struct timeb *);
#else
#ifdef MS_WINDOWS
#include <windows.h>
-#ifdef MS_WIN16
+#if defined(MS_WIN16) || defined(__BORLANDC__)
/* These overrides not needed for Win32 */
#define timezone _timezone
#define tzname _tzname
#define daylight _daylight
+#endif /* MS_WIN16 || __BORLANDC__ */
+#ifdef MS_WIN16
#define altzone _altzone
#endif /* MS_WIN16 */
#endif /* MS_WINDOWS */
#endif /* !__WATCOMC__ || __QNX__ */
-#if defined(MS_WIN32) && !defined(MS_WIN64)
+#if defined(MS_WIN32) && !defined(MS_WIN64) && !defined(__BORLANDC__)
/* Win32 has better clock replacement
XXX Win64 does not yet, but might when the platform matures. */
#include <largeint.h>
@@ -146,7 +148,7 @@ time_clock(PyObject *self, PyObject *args)
}
#endif /* HAVE_CLOCK */
-#if defined(MS_WIN32) && !defined(MS_WIN64)
+#if defined(MS_WIN32) && !defined(MS_WIN64) && !defined(__BORLANDC__)
/* Due to Mark Hammond */
static PyObject *
time_clock(PyObject *self, PyObject *args)
diff --git a/PC/config.h b/PC/config.h
index f6ad9c1..e146469 100644
--- a/PC/config.h
+++ b/PC/config.h
@@ -36,6 +36,7 @@ compiler specific". Therefore, these should be very rare.
#include <io.h>
#define HAVE_LIMITS_H
+#define HAVE_SYS_UTIME_H
#define HAVE_HYPOT
#define DONT_HAVE_SIG_ALARM
#define DONT_HAVE_SIG_PAUSE
@@ -177,6 +178,10 @@ typedef int pid_t;
#define LONG_LONG __int64
#undef HAVE_HYPOT
+#undef HAVE_SYS_UTIME_H
+#define HAVE_UTIME_H
+#define HAVE_DIRENT_H
+#define HAVE_CLOCK
#else /* !_WIN32 */
#error "Only Win32 and later are supported"
@@ -593,7 +598,7 @@ typedef unsigned long uintptr_t;
/* #define HAVE_SYS_UN_H 1 */
/* Define if you have the <sys/utime.h> header file. */
-#define HAVE_SYS_UTIME_H 1
+/* #define HAVE_SYS_UTIME_H 1 */
/* Define if you have the <sys/utsname.h> header file. */
/* #define HAVE_SYS_UTSNAME_H 1 */