/* System description file for Windows NT.
-Copyright (C) 1993-1995, 2001-2012 Free Software Foundation, Inc.
+Copyright (C) 1993-1995, 2001-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#define HAVE___BUILTIN_UNWIND_INIT 1
#endif
+/* This isn't perfect, as some systems might have the page file in
+ another place. Also, I suspect that the time stamp of that file
+ might also change when Windows enlarges the file due to
+ insufficient VM. Still, this seems to be the most reliable way;
+ the alternative (of using GetSystemTimes) won't work on laptops
+ that hibernate, because the system clock is stopped then. Other
+ possibility would be to run "net statistics workstation" and parse
+ the output, but that's gross. So this should do; if the file is
+ not there, the boot time will be returned as zero, and filelock.c
+ already handles that. */
+#define BOOT_TIME_FILE "C:/pagefile.sys"
+
/* ============================================================ */
/* Here, add any special hacks needed to make Emacs work on this
#endif
#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);
- sigset_t sa_mask;
-};
-#define SIG_BLOCK 1
-#define SIG_SETMASK 2
-#define SIG_UNBLOCK 3
-
#ifndef MAXPATHLEN
#define MAXPATHLEN _MAX_PATH
#endif
#endif
/* Calls that are emulated or shadowed. */
-#undef access
-#define access sys_access
#undef chdir
#define chdir sys_chdir
#undef chmod
#define chmod sys_chmod
-#define chown sys_chown
#undef close
#define close sys_close
#undef creat
#define strerror sys_strerror
#undef unlink
#define unlink sys_unlink
+/* This prototype is needed because some files include config.h
+ _after_ the standard headers, so sys_unlink gets no prototype from
+ stdio.h or io.h. */
+extern int sys_unlink (const char *);
#undef write
#define write sys_write
/* Subprocess calls that are emulated. */
#define spawnve sys_spawnve
-#define wait sys_wait
#define kill sys_kill
#define signal sys_signal
+/* Internal signals. */
+#define emacs_raise(sig) emacs_abort()
+
/* termcap.c calls that are emulated. */
#define tputs sys_tputs
#define tgetstr sys_tgetstr
/* Map to MSVC names. */
#define execlp _execlp
#define execvp _execvp
+#define fdatasync _commit
#define fdopen _fdopen
#ifndef fileno
#define fileno _fileno
#define strtoll _strtoi64
#endif
#define isatty _isatty
-#define logb _logb
#define _longjmp longjmp
#define lseek _lseek
#define popen _popen
#define stricmp _stricmp
#define tzset _tzset
+/* We cannot include system header process.h, since there's src/process.h. */
+int _getpid (void);
+
/* 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
long int tv_nsec; /* nanoseconds */
};
+/* Required for functions in lib/time_r.c, since we don't use lib/time.h. */
+extern struct tm *gmtime_r (time_t const * restrict, struct tm * restrict);
+extern struct tm *localtime_r (time_t const * restrict, struct tm * restrict);
+
+#ifdef _MSC_VER
/* This is hacky, but is necessary to avoid warnings about macro
- redefinitions using the SDK compilers. */
+ redefinitions using the MSVC compilers, since, when __STDC__ is
+ undefined or zero, those compilers declare functions like fileno,
+ lseek, and chdir, for which we defined macros above. */
#ifndef __STDC__
#define __STDC__ 1
#define MUST_UNDEF__STDC__
#undef __STDC__
#undef MUST_UNDEF__STDC__
#endif
+#else /* !_MSC_VER */
+#include <direct.h>
+#include <io.h>
+#include <stdio.h>
+#endif /* !_MSC_VER */
/* Defines that we need that aren't in the standard signal.h. */
#define SIGHUP 1 /* Hang up */
#define SIGPIPE 13 /* Write on pipe with no readers */
#define SIGALRM 14 /* Alarm */
#define SIGCHLD 18 /* Death of child */
+#define SIGPROF 19 /* Profiling */
#ifndef NSIG
#define NSIG 23
#endif
+#ifndef ENOTSUP
+#define ENOTSUP ENOSYS
+#endif
+
+#ifdef _MSC_VER
+typedef int sigset_t;
+typedef int ssize_t;
+#endif
+
+typedef void (_CALLBACK_ *signal_handler) (int);
+extern signal_handler sys_signal (int, signal_handler);
+
+struct sigaction {
+ int sa_flags;
+ void (_CALLBACK_ *sa_handler)(int);
+ sigset_t sa_mask;
+};
+#define SA_RESTART 0
+#define SIG_BLOCK 1
+#define SIG_SETMASK 2
+#define SIG_UNBLOCK 3
+
+extern int sigemptyset (sigset_t *);
+extern int sigaddset (sigset_t *, int);
+extern int sigfillset (sigset_t *);
+extern int sigprocmask (int, const sigset_t *, sigset_t *);
+extern int pthread_sigmask (int, const sigset_t *, sigset_t *);
+extern int sigismember (const sigset_t *, int);
+extern int setpgrp (int, int);
+extern int sigaction (int, const struct sigaction *, struct sigaction *);
+extern int alarm (int);
+
+extern int sys_kill (int, int);
+
+
/* For integration with MSDOS support. */
#define getdisk() (_getdrive () - 1)
#ifdef emacs
#include <malloc.h>
#endif
-/* stdlib.h must be included after redefining malloc & friends, but
- before redefining abort. Isn't library redefinition funny? */
#include <stdlib.h>
-
-/* Redefine abort. */
-#ifdef HAVE_NTGUI
-#define abort w32_abort
-extern _Noreturn void w32_abort (void);
-#endif
-
#include <sys/stat.h>
/* Define for those source files that do not include enough NT system files. */
#define sys_nerr _sys_nerr
#endif
+/* This must be after including stdlib.h, which defines putenv on MinGW. */
+#ifdef putenv
+# undef putenv
+#endif
+#define putenv sys_putenv
+extern int sys_putenv (char *);
+
extern int getloadavg (double *, int);
+extern int getpagesize (void);
+
+extern void * memrchr (void const *, int, size_t);
+
-#if defined (__MINGW32__) || _MSC_VER >= 1400
+#if defined (__MINGW32__)
/* Define to 1 if the system has the type `long long int'. */
# define HAVE_LONG_LONG_INT 1
/* Define to 1 if the system has the type `unsigned long long int'. */
# define HAVE_UNSIGNED_LONG_LONG_INT 1
-#elif _MSC_VER >= 1200
+#endif
+#ifdef _MSC_VER
+# if defined(_WIN64)
+typedef __int64 EMACS_INT;
+typedef unsigned __int64 EMACS_UINT;
+# define EMACS_INT_MAX LLONG_MAX
+# define PRIuMAX "llu"
+# define pI "ll"
+/* Fix a bug in MSVC headers : stdint.h */
+# define _INTPTR 2
+# elif defined(_WIN32)
/* Temporarily disable wider-than-pointer integers until they're tested more.
Build with CFLAGS='-DWIDE_EMACS_INT' to try them out. */
-# ifdef WIDE_EMACS_INT
+# ifdef WIDE_EMACS_INT
/* Use pre-C99-style 64-bit integers. */
typedef __int64 EMACS_INT;
typedef unsigned __int64 EMACS_UINT;
-# define EMACS_INT_MAX _I64_MAX
-# define pI "I64"
-
+# define EMACS_INT_MAX LLONG_MAX
+# define PRIuMAX "llu"
+# define pI "I64"
+# else
+typedef int EMACS_INT;
+typedef unsigned int EMACS_UINT;
+# define EMACS_INT_MAX LONG_MAX
+# define PRIuMAX "lu"
+# define pI "l"
+# endif
# endif
-
#endif
/* We need a little extra space, see ../../lisp/loadup.el. */
#define DebPrint(stuff)
#endif
+#ifdef _MSC_VER
+#if _MSC_VER >= 800 && !defined(__cplusplus)
+/* Unnamed type definition in parentheses.
+ A structure, union, or enumerated type with no name is defined in a
+ parenthetical expression. The type definition is meaningless. */
+#pragma warning(disable:4116)
+/* 'argument' : conversion from 'type1' to 'type2', possible loss of
+ data A floating point type was converted to an integer type. A
+ possible loss of data may have occurred. */
+#pragma warning(disable:4244)
+/* Negative integral constant converted to unsigned type.
+ An expression converts a negative integer constant to an unsigned type.
+ The result of the expression is probably meaningless. */
+#pragma warning(disable:4308)
+#endif
+#endif
#define TERM_HEADER "w32term.h"