]> code.delx.au - gnu-emacs/blobdiff - src/s/ms-w32.h
Merge from emacs-24; up to 2012-04-22T13:58:00Z!cyd@gnu.org
[gnu-emacs] / src / s / ms-w32.h
index 8b189baea46533ded43cf187ac05386e5de3a683..e89ecb0593189857d367b4659ed6c911026e057a 100644 (file)
@@ -1,6 +1,6 @@
 /* System description file for Windows NT.
 
-Copyright (C) 1993-1995, 2001-2011  Free Software Foundation, Inc.
+Copyright (C) 1993-1995, 2001-2012  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -86,6 +86,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
 
 #include <sys/types.h>
+
+#ifdef _MSC_VER
+typedef unsigned long sigset_t;
+typedef int ssize_t;
+#endif
+
 struct sigaction {
   int sa_flags;
   void (*sa_handler)(int);
@@ -111,11 +117,7 @@ struct sigaction {
 #undef  HAVE_UTIME_H
 #undef  HAVE_LINUX_VERSION_H
 #undef  HAVE_SYS_SYSTEMINFO_H
-#define HAVE_LIMITS_H 1
-#define HAVE_STRING_H 1
-#define HAVE_STDLIB_H 1
 #define HAVE_PWD_H 1
-#define STDC_HEADERS 1
 #define TIME_WITH_SYS_TIME 1
 
 #define HAVE_GETTIMEOFDAY 1
@@ -157,6 +159,9 @@ struct sigaction {
 #undef  HAVE_UTIMES
 #undef  HAVE_SETRLIMIT
 #undef  HAVE_SETPGID
+/* If you think about defining HAVE_GETCWD, don't: the alternative
+   getwd is redefined on w32.c, and does not really return the current
+   directory, to get the desired results elsewhere in Emacs */
 #undef  HAVE_GETCWD
 #define HAVE_SHUTDOWN 1
 
@@ -185,6 +190,17 @@ struct sigaction {
 
 #ifdef emacs
 
+#ifdef _MSC_VER
+#include <sys/timeb.h>
+#include <sys/stat.h>
+#include <signal.h>
+
+/* MSVC gets link-time errors without these redirections.  */
+#define fstat(a, b) sys_fstat(a, b)
+#define stat(a, b)  sys_stat(a, b)
+#define utime       sys_utime
+#endif
+
 /* Calls that are emulated or shadowed.  */
 #undef access
 #define access  sys_access
@@ -204,6 +220,7 @@ struct sigaction {
 #define dup2    sys_dup2
 #define fopen   sys_fopen
 #define link    sys_link
+#define localtime sys_localtime
 #define mkdir   sys_mkdir
 #undef mktemp
 #define mktemp  sys_mktemp
@@ -253,6 +270,8 @@ struct sigaction {
 #define getpid    _getpid
 #ifdef _MSC_VER
 typedef int pid_t;
+#define snprintf  _snprintf
+#define strtoll   _strtoi64
 #endif
 #define isatty    _isatty
 #define logb      _logb
@@ -261,15 +280,24 @@ typedef int pid_t;
 #define popen     _popen
 #define pclose    _pclose
 #define umask    _umask
+#ifndef _MSC_VER
 #define utimbuf          _utimbuf
+#endif
 #define strdup    _strdup
 #define strupr    _strupr
 #define strnicmp  _strnicmp
 #define stricmp   _stricmp
 #define tzset     _tzset
 
-#if !defined (_MSC_VER) || (_MSC_VER < 1400)
+/* Include time.h before redirecting tzname, since MSVC's time.h
+   defines _tzname to call a function, but also declares tzname a
+   2-element array.  Having the redirection before including the
+   header thus has the effect of declaring a function that returns an
+   array, and triggers an error message.  */
+#include <time.h>
 #define tzname    _tzname
+#if !defined (_MSC_VER) || (_MSC_VER < 1400)
+#undef  utime
 #define utime    _utime
 #endif
 
@@ -320,13 +348,17 @@ extern char *get_emacs_configuration_options (void);
 #define _WINSOCK_H
 
 /* Defines size_t and alloca ().  */
-#ifdef USE_CRT_DLL
+#ifdef emacs
 #define malloc e_malloc
 #define free   e_free
 #define realloc e_realloc
 #define calloc e_calloc
 #endif
+#ifdef _MSC_VER
+#define alloca _alloca
+#else
 #include <malloc.h>
+#endif
 
 #include <sys/stat.h>
 
@@ -385,4 +417,3 @@ extern void _DebPrint (const char *fmt, ...);
 
 
 /* ============================================================ */
-